6 条题解
-
11
#include <iostream> using namespace std; int main() { int a , b = 0 , c = 0 , d = 0 , e; for(int i = 1;i <= 12;i++) { cin >> a; b = b + 300; if(b < a) { c = 0 - i; break; } else { b = b - a; } if(b >= 100) { d += b - b % 100; b = b % 100; } } if(c != 0) { cout << c; } else { e = b + d + d / 5; cout << e; } return 0; }
-
2
yasuo
你说他怎么在最后一天把所有钱都给mum,就像199明明就差1,他却只给100,全给还能多得20%*99约=20%*100=20块=巨款👀️ ,Dsb
#include <iostream> int main(){ int money=0,money_mum=0,spend; for(int i=1;i<=12;i++){ std::cin>>spend; money+=300-spend; if(money<0){std::cout<<-1*i;return 0;} else {money_mum+=money/100*100;money-=money/100*100;}} std::cout<<1.2*money_mum+money;return 0;}
-
0
#include<iostream> using namespace std; int main() { int x,a=0,b=0,sum=0; bool flag=1; for(int i=1;i<=12;i++) { a+=300; cin >> x; if(x<=a) { if(a-x >=100) { b+=a-x-(a-x)%100; a-=a-x-(a-x)%100; } } else { flag=0; a=-i; break; } a-=x; } if(flag) { sum=a+b*1.2; } else { sum=a; } cout << sum; return 0; }
-
0
#include<bits/stdc++.h> using namespace std; int main(){ int x=0,n,m=0,c=0; for(int x=1;x<=12;x++) {// 十二个月 cin>>n; // 输入每个月预算 m=m+300-n; // 余钱 c=c+m/100; // 存入c个整百到妈妈手上 m=m%100; // 存入后剩下得钱 if(m<0){ // 钱不够 小于0 cout<<-x; //输出当前-月份 结束程序 return 0; } } cout<<m+100*c*1.2; // 年末输出全部钱 return 0; }
😄 🎉️ 🎉️ 🎉️ 😄
-
0
本题我采用模拟法 a 表示手里的钱 s 表示存妈妈那里的钱 z是状态码
#include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { int a=0,s=0,z=0; for (int i=1;i<=12;i++) { a+=300;///每月拿300元 int b; cin>>b; a-=b; if (a<0)///不够花 { cout<<"-"<<i; z=1; break; } if (a/100>0)///判断手中的钱 { s+=a/100*100; a=a-a/100*100; } } if (z==0) { cout<<1.2*(1.0*s)+a; } return 0; }
- 1
信息
- ID
- 178
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 5775
- 已通过
- 1287
- 上传者