##printf()里不用加‘&’
by JYTS @ 2018-01-06 19:28:14
@[Mr\_Sympathetic](/space/show?uid=78427)
by JYTS @ 2018-01-06 19:28:20
嗯,那有点问题。
但主要问题是程序编译过了以后不对
by Mr_Sympathetic @ 2018-01-07 00:35:18
输入数据结果不对
by Mr_Sympathetic @ 2018-01-07 00:35:59
@[大帅哥就是ME](/space/show?uid=60072)
by Mr_Sympathetic @ 2018-01-07 15:57:40
@[Mr\_Sympathetic](/space/show?uid=78427)
运行了下好像是else{}里面(mon++)计数有问题,导致不只读了12个,无法跳出循环,建议就用if判定即可
附代码
```cpp
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
int main()
{
int x,y,z,m,a;
x=0; y=0;
z=0; m=0;
for ( int i=1;i<=12; i++)
{
cin>>a;
m=300+m;
m-=a;
if (m<0){cout<<"-"<<i;return 0;}
if (m>=100&&m<200)
{
x+=100;
m-=100;
}
if (m>=200&&m<300)
{
x+=200;
m-=200;
}
if (m>=300)
{
x+=300;
m-=300;
}
}
cout<<1.2*x+m;
return 0;
}
```
by JYTS @ 2018-01-08 21:42:30
谢谢啦
by Mr_Sympathetic @ 2018-01-08 23:31:28