社区讨论
40分求助,C++
P1089[NOIP 2004 提高组] 津津的储蓄计划参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @lo7yyy4z
- 此快照首次捕获于
- 2023/10/27 10:03 2 年前
- 此快照最后确认于
- 2023/10/27 10:03 2 年前
CPP
#include <bits/stdc++.h>
using namespace std;
int main(){
int x[12],temp=0,ans,n;
const int y=300;
for (int i=0;i<12;i+=1){
cin>>x[i];
}
for (int i=0;i<12;i+=1){
n+=y;
n=n-x[i];
if(n<0){
ans=0-(i+1);
break;
}
if(n>=100){
temp+=(floor(n/100))*100;
n-=floor(n/100)*100;
}
}
if (ans>=0){
ans=n+1.2*temp;
}
cout<<ans<<endl;
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...