696

#include <iostream> #include <cstdio> using namespace std; int main() { int r,c,tmp,res; int row,col; //FILE *fp; //fp=fopen("out.txt","w"); while(scanf("%d%d",&r,&c)) { if(r+c==0) break; if((r==1 || c==1) || r==0 || c==0) { printf("%d knights may be placed on a %d row %d column board.\n",r*c,r,c); //fprintf(fp,"%d knights may be placed on a %d row %d column board.\n",r*c,r,c); continue; }

278

#include <iostream> #include <cstdio> using namespace std; int main() { int t; int row,col; char ch,c; scanf("%d%c",&t,&ch); while(t–) { scanf("%c%d%d%c",&ch,&row,&col,&c); if(ch=='r') { printf("%d\n",(row<=col?row:col)); } else if(ch=='k') { //knight alwsy attacks of the other color squares, so total non attacking //knighta are = half of the area //if total square is odd, i.e. dimensions are odd

11608

#include <iostream> #include <cstdio> //#include <fstream> using namespace std; //ofstream out; int main() { int kase=1; int arr[15]; int init_problem_num; int total_problem[15]; int problem_required[15]; //out.open("out.txt"); while(scanf("%d",&init_problem_num)) { if(init_problem_num<0) break; total_problem[0]=init_problem_num; for(int i=0;i<12;i++) { scanf("%d",&arr[i]); if(i>0) total_problem[i]=total_problem[i-1]+arr[i-1]; } for(int i=0;i<12;i++) scanf("%d",&problem_required[i]); printf("Case %d:\n",kase); //out<<"Case "<<kase<<":\n"; kase+=1; int problem_used=0; for(int i=0;i<12;i++) { if(problem_required[i]<=(total_problem[i]-problem_used)) { printf("No problem! :D\n");

11650

#include <cstdio> #include <iostream> #include <cstring> #include <string> using namespace std; void printTime(int tyme) { if(tyme<10) { printf("0%d\n",tyme); } else { printf("%d\n",tyme); } } int main() { int t,hour,min; scanf("%d",&t); char s[10]; int highest = 12*60; int lowest = 0; int mirror; while(t–) { scanf("%s",s); hour = (s[0]-'0')*10; hour += (s[1]-'0'); hour%=12; min = (s[3]-'0')*10;