18-year-old birthday:
1#include <stdio.h>2 intm[ -]={ to, -, to, -, to, -, to, to, -, to, -, to};3 intNianintx) {4 if(% -==0|| (%4==0&&x% -!=0))return 1;5 Else return 0;6 }7 intFindintXintYintz) {8 if(Nian (x)) m[1]= in;9 Elsem[1]= -;Ten inttot=0; One for(intI=0; i<y-1; i++) tot+=M[i]; A returntot+Z; - } - intMain () { the intx,y,z,tot,t; -scanf"%d",&T); - while(t--) {tot=0; scanf ("%d-%d-%d",&x,&y,&z); - if(y==2&&z== in) puts ("-1"); + Else{ - for(inti=x+1; i<x+ -;++i) { + if(Nian (i)) tot+=366; A Elsetot+=365; at } - if(Nian (x)) tot+=366-find (x, y, z); - Elsetot+=365-find (x, y, z); -printf"%d\n", Tot+find (x+ -, Y,z)); - } - } in return 0; -}
Hollow Triangles:
#include <stdio.h>#include<string.h>intMain () {Charc,m[ -][ -];intn,x,y,flot=0; while(SCANF ("%c%d", &c,&n), c!='@') {memset (M,0,sizeof(m));if(Flot) puts (""); flot++; GetChar (); for(y=0; y<n;++y) for(x=0;x<2*N;++X) m[y][x]=' '; for(y=0; y<n;++y) { for(x=0;x<2*n;++x) {M[y][n-1-y]=C; M[y][n-1+y]=C; if(y==n-1) m[y][x]=C; M[y][n+y]=' /'; } printf ("%s\n", M[y]); } } return 0;}
Several water problems (18-year-old birthday, hollow triangle)