随笔分类 -  ACM POJ

摘要:1 #include <stdio.h> 2 #include <string.h> 3 char haab[18][10]={ 4 "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", 5 "yax", "zac", "ceh", "mac& 阅读全文
posted @ 2011-08-06 20:19 IT屁民 阅读(299) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 char d[100][51]; 5 struct node 6 { 7 int p; 8 int r; 9 };10 11 node s[100];12 13 int cmp( constvoid*a, constvoid*b)14 {15 return ((node*)a)->r - ((node*)b)->r;16 }17 int DNAsort(char a[],int n)18 {19 int count =0;20 for(int i =0; i < 阅读全文
posted @ 2011-08-06 17:56 IT屁民 阅读(175) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;int main(int argc, char* argv[]){ int p,e,i,d; int index=0; while(cin>>p>>e>>i>>d) { if(p==-1) break; int n=(5544*p+14421*e+1288*i-d)%(21252); if(n<=0) n+=21252; cout<<"Case "<<++index<<": the nex 阅读全文
posted @ 2011-08-05 22:08 IT屁民 阅读(163) 评论(0) 推荐(0)
摘要:#include <stdio.h>#define PI 3.1415926int main(){ int n, i = 0, year; double x, y, area; scanf("%d", &n); while (i < n) { scanf("%lf %lf", &x, &y); area = 0.5 * PI * (x*x+y*y); year = area/50; printf("Property %d: This ... 阅读全文
posted @ 2011-08-05 20:45 IT屁民 阅读(156) 评论(0) 推荐(0)
摘要:#include <stdio.h>long a[500005];long long merge_inversions(long p, long q, long r){ long n1 = q - p + 1; long n2 = r - q; long *left = new long[n1+1]; long *right = new long[n2+1]; long i, j; for(i = 0; i < n1; i++) left[i] = a[p + i]; for(j = 0; j < n2; j++) right[j] = a[q + j + 1]; le 阅读全文
posted @ 2011-07-19 22:30 IT屁民 阅读(193) 评论(0) 推荐(0)
摘要:又是水题。。看来POJ开头的都是水题啊~#include <stdio.h>int main(){ freopen("1.txt", "r", stdin); float sum = 0, t; int m = 0; while( scanf("%f", &t) != EOF ) { sum += t; m++; } printf("$%.2f\n", sum/m);} 阅读全文
posted @ 2011-07-14 20:53 IT屁民 阅读(125) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #define E 0.001 3 4 int main() 5 { 6 double t; 7 while( scanf("%lf", &t) && t <=-E || t >= E ) 8 { 9 double sum =0, i;10 for(i =2; ; i++)11 {12 sum +=1/i;13 if( sum - t > E)14 break;15 }16 printf("%d card(s)\n", (int)(i-1) );17 }1 阅读全文
posted @ 2011-07-14 20:32 IT屁民 阅读(190) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>char index[100002][100];int index_i = 0;int cmp( const void *a, const void *b){ return strcmp( (char*)a, (char*)b );}void MapToNum(char des[], char src[]){ int j = 0; for(int i = 0; src[i] != '\0 阅读全文
posted @ 2011-07-08 20:21 IT屁民 阅读(184) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h>int a[200], f[200];int main(){ char str[7]; int r[7]; int n; while( scanf("%s %d", str, &n) != EOF ) { strrev(str); int k = 0, flag = 0, _k = 0, dotpos; memset(a, 0, sizeof(a)); for(int p = 0; str[p]!='\0'; p++) if( str[p] !=  阅读全文
posted @ 2011-07-07 20:43 IT屁民 阅读(215) 评论(0) 推荐(0)