- 捕风捉影
- 2016-07-21 17:05:14 @
记录信息
评测状态 Time Limit Exceeded
题目 P1042 捕风捉影
递交时间 2016-07-21 16:48:34
代码语言 C++
评测机 ShadowShore
消耗时间 3700 ms
消耗内存 552 KiB
评测时间 2016-07-21 16:48:39
评测结果
编译成功
测试数据 #0: Accepted, time = 15 ms, mem = 552 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #2: Accepted, time = 250 ms, mem = 552 KiB, score = 10
测试数据 #3: Accepted, time = 312 ms, mem = 552 KiB, score = 10
测试数据 #4: Accepted, time = 78 ms, mem = 552 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #6: TimeLimitExceeded, time = 1015 ms, mem = 552 KiB, score = 0
测试数据 #7: TimeLimitExceeded, time = 1015 ms, mem = 552 KiB, score = 0
测试数据 #8: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #9: TimeLimitExceeded, time = 1015 ms, mem = 552 KiB, score = 0
TimeLimitExceeded, time = 3700 ms, mem = 552 KiB, score = 70
代码
#include <bits/stdc++.h>
bool check(int x) {
int a[10],l = 0,t = -1;;
int o = (int)sqrt(x);
if(x <= 1)
return false;
for(int i = 2;i <= o;i++)
if(x%i == 0)
return false;
while (x) {
++l;
a[++t] = x%10;
x /= 10;
}
for (int i = 0;i <= l/2-1;i++)
if (a[i] != a[l-i-1]) return false;
return true;
}
int main() {
int L,R;
scanf("%d%d",&L,&R);
R = std :: min(R,9989990);
for (int i = L;i <= R;i++)
if (check(i)) printf("%d\n",i);
return 0;
}
_________________________________________________________________________
记录信息
评测状态 Time Limit Exceeded
题目 P1042 捕风捉影
递交时间 2016-07-21 16:58:17
代码语言 C++
评测机 ShadowShore
消耗时间 3277 ms
消耗内存 552 KiB
评测时间 2016-07-21 16:58:23
评测结果
编译成功
测试数据 #0: Accepted, time = 0 ms, mem = 548 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 548 KiB, score = 10
测试数据 #2: Accepted, time = 46 ms, mem = 548 KiB, score = 10
测试数据 #3: Accepted, time = 93 ms, mem = 552 KiB, score = 10
测试数据 #4: Accepted, time = 78 ms, mem = 548 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 548 KiB, score = 10
测试数据 #6: TimeLimitExceeded, time = 1015 ms, mem = 548 KiB, score = 0
测试数据 #7: TimeLimitExceeded, time = 1015 ms, mem = 552 KiB, score = 0
测试数据 #8: Accepted, time = 15 ms, mem = 552 KiB, score = 10
测试数据 #9: TimeLimitExceeded, time = 1015 ms, mem = 548 KiB, score = 0
TimeLimitExceeded, time = 3277 ms, mem = 552 KiB, score = 70
代码
#include <bits/stdc++.h>
bool check(int x) {
int a[10],l = 0,t = -1;;
int o = (int)sqrt(x);
if(x <= 1)
return false;
for(int i = 2;i <= o;i++)
if(x%i == 0)
return false;
while (x) {
++l;
a[++t] = x%10;
x /= 10;
}
for (int i = 0;i <= l/2-1;i++)
if (a[i] != a[l-i-1]) return false;
return true;
}
int main() {
int L,R;
scanf("%d%d",&L,&R);
R = std :: min(R,10000000);
int i = L;
while (i <= R) {
if (i == 5 || i == 7 || i == 11) printf("%d\n",i);
if ((i > 100) && (i < 999))
if (check(i)) printf("%d\n",i);
if (i > 10000 && i < 99999 )
if (check(i)) printf("%d\n",i);
if (i > 1000000 && i < 9999999)
if (check(i)) printf("%d\n",i);
if (i > 100000000 && i < 999999999)
if (check(i)) printf("%d\n",i);
if (i > 11 && i < 99) i = 99;
if (i > 1000 && i < 9999) i = 9999;
if (i > 100000 && i < 999999 ) i = 999999;
if (i > 10000000 && i < 99999999) i = 99999999;
i++;
}
return 0;
}
救救我
0 条评论
目前还没有评论...