Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水题,但是有个大坑!!!就是那个Mxxxx那个人的位置是不能占的! 然后‘closest’的定义又不清楚进一步加深误解!过了样例会以为当占了M的位置的时猴为1,那个位置的令居是2,等等(实际上是以距离祘的,因为M的位置也就是0號位置是不能占的,题目说的太模糊了) #include <iostream> #include <stdio.h> using namespace std; struct node{ node *prev, *suc; int label; }; int gua[501] = {0,0,1,1,0,0,3,4,3,0,5,9,0,2,3,3,2,0,15,11,6,0,15,7,22,12,1,16,3,18,3,18,1,16,31,11,26,4,19,34,9,24,39,11,26,41,10,25,40,6,21,36,51,13,28,43,2,17,32,47,2,17,32,47,62,12,27,42,57,3,18,33,48,63,4,19,34,49,64,0,15,30,45,60,75,5,20,35,50,65,80,4,19,34,49,64,79,94,11,26,41,56,71,86,101,11,26,41,56,71,86,101,4,19,34,49,64,79,94,109,4,19,34,49,64,79,94,109,124,10,25,40,55,70,85,100,115,130,7,22,37,52,67,82,97,112,127,142,9,24,39,54,69,84,99,114,129,144,1,16,31,46,61,76,91,106,121,136,151,166,11,26,41,56,71,86,101,116,131,146,161,176,9,24,39,54,69,84,99,114,129,144,159,174,189,9,24,39,54,69,84,99,114,129,144,159,174,189,204,10,25,40,55,70,85,100,115,130,145,160,175,190,205,220,11,26,41,56,71,86,101,116,131,146,161,176,191,206,221,236,11,26,41,56,71,86,101,116,131,146,161,176,191,206,221,236,251,9,24,39,54,69,84,99,114,129,144,159,174,189,204,219,234,249,264,4,19,34,49,64,79,94,109,124,139,154,169,184,199,214,229,244,259,274,289,9,24,39,54,69,84,99,114,129,144,159,174,189,204,219,234,249,264,279,294,309,8,23,38,53,68,83,98,113,128,143,158,173,188,203,218,233,248,263,278,293,308,323,0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345,360,12,27,42,57,72,87,102,117,132,147,162,177,192,207,222,237,252,267,282,297,312,327,342,357,372,387,13,28,43,58,73,88,103,118,133,148,163,178,193,208,223,238,253,268,283,298,313,328,343,358,373,388,403,2,17,32,47,62,77,92,107,122,137,152,167,182,197,212,227,242,257,272,287,302,317,332,347,362,377,392,407,422,437,6,21,36,51,66,81,96,111,126,141,156,171,186,201,216,231,246,261,276,291,306,321,336,351,366,381,396,411,426,441,456,471,8,23,38,53,68,83,98,113,128,143,158,173,188,203,218,233,248,263,278,293,308,323,338}; int main() { //cout << gua[500]; /* for(int i = 2; i <= 500; i++){ node nodes[505]; for(int j = 0; j < i; j++){ nodes[j].label = j; nodes[j].prev = nodes + (j+i-1)%i; nodes[j].suc = nodes + (j+1)%i; } node *cur = nodes; for(int j = 0; j < i-1; j++){ for(int k = 0; k < 14; k++) cur = cur->suc; cur->prev->suc = cur->suc; cur->suc->prev = cur->prev; cur = cur->suc; } cout << cur-nodes << ","; } */ while(1){ int low, high; scanf("%d%d", &low, &high); if(low == 0 && high == 0) return 0; bool KY = 0; if(low > high){ int temp = low; low = high; high = temp; } for(int i = 1; i <= low/2; i++){ bool ky = 1; for(int j = low; j <= high; j++){ if(i == gua[j] || (j-i)%j == gua[j]){ ky = 0; break; } } if(ky){ printf("%d\n", i); KY = 1; break; } } if(!KY){ printf("Better estimate needed\n"); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator