- 告别情人节
- 2016-08-24 18:32:34 @
你自己去看看就清楚了
1 条评论
-
lrj124 LV 10 @ 2016-08-25 12:58:46
记录信息 评测状态 Accepted 题目 P1938 告别情人节 递交时间 2016-08-24 22:02:36 代码语言 C++ 评测机 ShadowShore 消耗时间 0 ms 消耗内存 900 KiB 评测时间 2016-08-24 22:02:37 评测结果 编译成功 测试数据 #0: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #1: Accepted, time = 0 ms, mem = 900 KiB, score = 10 测试数据 #2: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #3: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #4: Accepted, time = 0 ms, mem = 892 KiB, score = 10 测试数据 #5: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #6: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #7: Accepted, time = 0 ms, mem = 900 KiB, score = 10 测试数据 #8: Accepted, time = 0 ms, mem = 896 KiB, score = 10 测试数据 #9: Accepted, time = 0 ms, mem = 896 KiB, score = 10 Accepted, time = 0 ms, mem = 900 KiB, score = 100 代码 #include<cstdio> #include<cstring> using namespace std; int main() { int h[100001] = {6,2,5,5,4,5,6,3,7,6}; for(int i = 10;i <= 9999;i++) { int a[5]; memset(a,0,sizeof(a)); int k = i,t = 1; while (k) { a[t++] = k%10; k /= 10; } if (i <= 99 && i >= 10) h[i] = h[a[1]]+h[a[2]]; else if (i <= 999 && i >= 100) h[i] = h[a[1]]+h[a[2]]+h[a[3]]; else if (i <= 9999 && i >= 1000) h[i] = h[a[1]]+h[a[2]]+h[a[3]]+h[a[4]]; } int a,b; scanf("%d %d",&a,&b); printf("%d",h[a]-h[b]); return 0; }
- 1