1 条题解
-
0
C :
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main() { // freopen("in","r",stdin); // freopen("out","w",stdout); int x, y, z, count = 0; for (x = 1; x <= 28; x++) { for (y = 1; y <= 73; y++) { z = 100 - x - y; if (5*x + 2*y + z == 150) { count++; printf("%d %d %d\n", x, y, z); } } } printf("%d\n", count); return 0; }
C++ :
#include<stdio.h> int main() { int i,j,k,m,cunter = 0; for(i = 1;i <=12;i++) { for(j = 1;j <= 46;j++) { k = 150 - 5*i - 2*j; if((i + j < 100) && (5*i + j*2 + k == 150) && k < 100 && (i + j + k) == 100) { printf("%d %d %d\n",i,j,k); cunter++; } } } printf("%d\n",cunter); return 0; }
- 1
信息
- ID
- 3367
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者