社区讨论
萌新求助
P1089[NOIP 2004 提高组] 津津的储蓄计划参与者 2已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @mi7pcobl
- 此快照首次捕获于
- 2025/11/21 01:25 4 个月前
- 此快照最后确认于
- 2025/11/21 01:25 4 个月前
不知道为啥wa全是第一列第三行的读几预计几的错误(分别是2 3 5 7 9 10)
import java.util.Scanner;
//import java.util.Scanner;
public class Main {
CPP public static void main(String[] args){
Scanner in=new Scanner(System.in);
int d =0;//存钱
int sun=0;//零钱
int c=0;
int[]l=new int[12];
boolean m=false;
int r=0;
int v=0;
no1:
for( int i=0;i<12;i++){
int kaix=in.nextInt();
sun+=300;
if(kaix>sun){
m=true;
l[v]=i;
v++;
}
else{
c=sun-kaix;
// if(c>=300){
// d+=300;
// sun=c-300;
// continue no1;
// }
// if(c>=200){
// d+=200;
// sun=c-200;
// continue no1;
// }
// if(c>=100){
// d+=100;
// sun=c-100;
// continue no1;
// }
while(c>=100){
d+=100;
sun=c-100;
c=c-100;
if(c<100)
continue no1;
}
/else/ sun=c;
}
}
CPP if(m){
System.out.print("-"+(l[0]+1));
}
if(m==false){
System.out.print((int)((int)d*1.2));
}
}
}
CPP
回复
共 3 条回复,欢迎继续交流。
正在加载回复...