#include <stdio.h> int child[105]; int book[105]; int main(void) { int N; int i; int sum0 = 0, sum1 = 0; scanf("%d", &N); for (i=0; i<N; i++) { scanf("%d", child+i); sum0 += child[i]; } while (1) { int flg = 1; for (i=0; i<N; i++) { child[i] /= 2; book[i] = child[i]; } for (i=1; i<N; i++) { child[i] += book[i-1]; } child[0] += book[N-1]; for (i=0; i<N; i++) { if (child[i]%2 == 1) { child[i]++; } } for (i=1; i<N; i++) { if (child[0] != child[i]) { flg = 0; break; } } if (flg) { break; } } for (i=0; i<N; i++) { sum1 += child[i]; } printf("%d\n", sum1-sum0); return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:827 |
printf基础练习2 (C语言代码)浏览:826 |
简单的a+b (C语言代码)浏览:560 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:628 |
Cylinder (C语言描述+详细分析)浏览:3375 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:702 |
矩阵加法 (C语言代码)浏览:1768 |
1012题解浏览:938 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:331 |
矩形面积交 (C语言代码)浏览:1433 |