1 条题解
-
0
C :
#include<stdio.h> void main() { int a,b,c,i=0; for(a=1;a<100;a++){ for(b=1;b<(100-a)/2;b++){ c=(100-a-2*b)/5; if(a+2*b+5*c==100) i++; } } printf("%d",i); }
C++ :
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main(){ int a,b,c,s=0; for(a=1;a<=1*100/5;a++){ for(b=1;b<=1*100/2;b++){ for(c=1;c<=1*100/1;c++){ if(a*5+b*2+c*1==1*100){ s=s+1; } } } }cout<<s<<endl; }
Python :
b = 0 for i in range (1, 100): for m in range (1, 50): for n in range (1, 20): if i * 1 + 2 * m + n * 5 == 100 and i != 0 and m != 0 and n != 0: b += 1 print(b)
- 1
信息
- ID
- 61
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 6
- 标签
- 递交数
- 17
- 已通过
- 12
- 上传者