睡前一水 zoj 1009 html #include <stdio.h> #include <string.h> #include <memory.h> int main(void) { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); char a[88]; char hang[81]; int len = 0; memset (hang,'-',sizeof(hang)); hang[80]='/0'; while(scanf("%s",a) != EOF) { if(strcmp(a,"<br>") == 0) { printf("/n"); len = 0; } if(strcmp(a,"<hr>") == 0) { if (len==0) printf("%s/n",hang); else printf("/n%s/n",hang); len = 0; } if(len + strlen(a)>80&&strcmp(a,"<hr>")&&strcmp(a,"<br>")) { printf("/n%s",a); len = strlen(a)+1; } else if(strcmp(a,"<hr>")&&strcmp(a,"<br>")) { if(len) printf(" %s",a); else printf("%s",a); len += strlen(a)+1; } } return 0; } zoj 1006 #include <stdio.h> #include <string.h> #include <stdlib.h> int op1(char x) { if (x=='_') return 0; if (x=='.') return 27; return x - 'a'+1; } char op2(int n) { if (n==27) return '.'; if (n==0) return '_'; return n+'a'-1; } int main(void) { int k,i; char str[100]; int ciphercode[100]; int plaincode[100]; while (scanf("%d",&k) != EOF && k) { scanf("%s",str); int len = strlen(str); for (i=0;i!= len ;i++) { ciphercode[i] = op1(str[i]); plaincode[i*k%len] = ciphercode[i] + i; if (plaincode[i*k%len] >= 28) plaincode[i*k%len] %= 28; } for (i=0;i!=len;i++) { printf("%c",op2(plaincode[i])); } printf("/n"); /*for (i=0;i!=len;i++) printf("%d",plaincode[i]); printf("/n"); for (i=0;i!=len;i++) printf("%d",ciphercode[i]); printf("/n");*/ } return 0; } zoj 1365 #include <stdio.h> int main (void) { char waste1[50],waste2[50]; char judge[10]; int sum=0; while (1) { int val; scanf("%s",waste1); if (waste1[0] == '#') break; if (waste1[0] == '0') { printf("%d/n",sum); sum = 0; continue; } scanf("%s",waste2); scanf("%d",&val); scanf("%s",judge); if (judge[0] == 'F') sum+=val*2; if (judge[0] == 'B') sum =sum +val/2+val; if (judge[0] == 'Y') { if (val>500) sum += val; else sum += 500; } } return 0; }