280 条题解
-
0HBat LV 8 @ 2015-10-20 01:43:45
水
#include <iostream>using namespace std;
int k[12];
int main()
{
int i,j;
for(i=0;i<12;++i)
{
cin>>k[i];
}
int money=0;
int keepm=0;
for(i=0;i<12;++i)
{
money+=300;
money-=k[i];
if(money<0)
{
cout<<'-'<<i+1;
return 0;
}else if(money/100>=0)
{
j=(money/100)*100;
keepm+=j;
money%=100;
}
}
j=keepm/5;
keepm+=j;
keepm+=money;
cout<<keepm;
return 0;
} -
02015-09-30 18:38:23@
这题有毒
#include <stdio.h>int main(){
int pre[12];
int i,now=0,mother=0;
for(i=0;i<12;i++)
scanf("%d",&pre[i]);
for(i=0;i<12;i++){
now=now+300-pre[i];
if(now<0){
printf("-%d",i+1);
return 0;
}
else{
mother+=now/100;
now=now%100;
}
}
printf("%d",now+120*mother);
return 0;
} -
02015-09-30 13:07:30@
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a[14],i,sum=0,lixi=0,cun,max=0;
for(i=1;i<=12;i++){
scanf("%d",&a[i]);
}
for(i=1;i<=12;i++){
sum+=300;
if(a[i]>sum){
printf("-%d",i);
return 0;
}
else if(sum-a[i]>=100){cun=(sum-a[i])/100*100;
max+=cun;
lixi+=cun/5;
sum=sum-cun-a[i];
}
else{
sum=sum-a[i];
continue;
}
}
printf("%d",lixi+sum+max);
return 0;
} -
02015-09-15 09:46:34@
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;int num[15];
int main(){
int flag = 0, ans = 0, bri = 0;
for(int i=1; i<=12; i++)
scanf("%d", &num[i]);
for(int i=1; i<=12; i++){
ans += 300;
ans -= num[i];
if(ans < 0){
flag = i;
break;
}
else
while(ans >= 100){
ans -= 100;
bri += 100;
}
}
if(flag)
printf("-%d", flag);
else
printf("%d", ans + bri/5 + bri);
system("pause");
return 0;
} -
02015-08-06 21:36:40@
#include <iostream>
//#include <fstream>
using namespace std;
int main()
{
//ifstream cin("p1096.in",ios::in);
//ofstream cout("p1096.out",ios::out);
int last[12]={0};
int error=0;
for(int i=0;i<12;cin>>last[i++]);
int now=0,future=0;
for(int i=0;i<12;i++)
{
now+=300;
if(now<last[i])//津津手中的钱加上这个月妈妈给的钱,不够这个月的原定预算
{
error=i+1;
break;
}
int remain=now-last[i];//月末剩下的钱
if(remain>=100)//如果她预计到这个月的月末手中还会有多于100元或恰好100元
future+=remain-remain%100;//她就会把整百的钱存在妈妈那里
now=remain%100;
}
if(error)cout<<'-'<<error;//输出-X,X表示出现这种情况的第一个月
else cout<<(future*1.2)+now<<endl;
//cin.close();
//cout.close();
return 0;
} -
02015-07-13 11:32:39@
#include<iostream>
#include<cstdio>
using namespace std;
int a[12];
int main()
{
for(int i=0;i<=11;i=i+1)
cin>>a[i];
int x,y,z,n,m;
y=0;z=0;n=0;m=0;
for(int i=0;i<=11;i=i+1)
{
z=z+(300+y-a[i])/100*100;
if(300+y-a[i]<0&&n==0)
{
n=n+1;
m=i;
y=0;
}
y=(300+y-a[i])%100;
}
z=1.2*z+y+1;
if(n==0)
{
cout<<z;
}
else
{
cout<<"-"<<m+1;
}
return 0;
} -
02015-03-10 21:50:43@
#include<iostream>
using namespace std;
int main()
{
int budget[12];
for(int i=0;i<12;i++)
{
cin>>budget[i];
}
int w=0,m=0;
for(int i=0;i<12;i++)
{
w=w+300;
w-=budget[i];
if(w>=100)
{
//存钱
int r=(w)/100;
m=m+r*100;
w=w-r*100;
}
if(w<0)
{
cout<<"-"<<i+1;
return 0;
}}
w=w+(m+0.5)*1.2;
cout<<w;
return 0;
}
精度问题。。。。(m+0.5)*1.2.。。。 -
02015-01-17 12:28:32@
晕,*1.2根本没什么难度,交题目的时候尽听题解瞎扯。人家都是100的倍数了,1.2不是很easy么- -
害我忘记+回原来现有的钱,没一次AC,嘛,算了- -这种小题目随便了。###block code
program P1096;
var data:array[1..12] of longint;
money,now,s,m,i:longint;
pd:boolean;
begin
now:=0; money:=0; pd:=false;
for i:=1 to 12 do
read(data[i]);for i:=1 to 12 do
begin
now:=now+300; s:=now-data[i]; //拿钱操作,s是差值
if s<0 then begin pd:=true; m:=i; break; end; //s小于0,预算不够,记录月份,直接退出
money:=money+(s div 100)*100; //存钱操作
s:=s mod 100; now:=s; //计算手上还剩多少
end;if pd=true then begin write('-',m); exit; end; //钱不够的话就这里就终止输出月份,有40分
now:=now+money+money*2 div 10; //钱够的情况,计算手上的钞票,有60分。
write(now); //钱够的情况的答案
end. -
02015-01-03 14:20:29@
#include<iostream>
using namespace std;
int a[13]={0};
int deposit=0;
int n=0;//定义每月剩余的钱数
int main()
{
for(int i=1;i<=12;i++)//输入12个月的预算
{
cin>>a[i];
}
for(int i=1;i<=12;i++)//计算每个月的开销
{
n=n+300-a[i];//剩余钱数
if(n>=0)//钱够花
{
if(n>=100)
{
int a;
a=n/100;
deposit=deposit+a*100;
n=n-a*100;
}
}
else
{
cout<<"-"<<i;
return 0;
}
}cout<<deposit*1.2+n<<endl;
}
-
02014-12-16 18:28:06@
#include<iostream>
using namespace std;
int main()
{
int jieyu=0,a[13],b;
double tot=0;
for(int i=1;i<=12;++i)
cin>>a[i];
for(int i=1;i<=12;++i)
{
if(jieyu+300<a[i])
{
cout<<"-"<<i;
return 0;
}
else
{
b=(jieyu+300-a[i])/100;
tot=tot+b*100;
jieyu=jieyu+300-a[i]-b*100;
}
}
tot=tot*1.2;
tot=tot+jieyu;
cout<<tot;
return 0;
} -
02014-11-07 18:32:42@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;int main(){
int mon[13],i,j=0,k,l,zong=0,m=0,n;
for (i=1;i<=12;i++){
scanf("%d",&mon[i]);
}
for (i=1;i<=12;i++){
k=j+300;
j=k-mon[i];
if (j<0){
m=-i;
printf("%d",m);
break;
}
l=j/100;
if (l>0){
zong+=l*100;
j-=l*100;
}
}
n=zong*1+zong*0.2;
if (m==0){
printf("%d",n+j);
}
return 0;
} -
02014-11-06 17:03:34@
#include<stdio.h>
include<stdlib.h>
using namespace std;
int main()
{int a[12],i,ret=0,tmp,cunkuan=0,dangqian=0;
for(i=0;i<12;i++) scanf("%d",&a[i]); for(i=0;i<12;i++) { dangqian=dangqian+300-a[i]; tmp=dangqian/100; if(dangqian<0){ret=(i+1)*-1;break;} else if(tmp>0)
{
cunkuan+=tmp*100;
dangqian=dangqian%100;
}
ret=cunkuan+cunkuan/5+dangqian;
}
printf("%d",ret);return 0;
} -
02014-11-05 11:33:18@
本站除(A+B问题)外第一水题
-
02014-11-03 08:19:06@
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[12],z=0,i,max=0,bz=0,mom=0;
for(i=0;i<12;i++)
{
scanf("%d",&a[i]);
}for(i=0;i<12;i++)
{
max=max+300-a[i];
if(max>=0)
{
if((bz=max/100)>0)
{
max=max-bz*100;
mom=mom+bz*100;
z=mom+mom/5+max;
}
}
else
if(max<0)
{
x=-(i+1);
break;
}
}
printf("%d",z);
return 0;
} -
02014-11-02 20:02:26@
var i,t,cun:integer;
a:array[1..12] of integer;
begin
for i:=1 to 12 do readln(a[i]);
for i:=1 to 12 do
begin
t:=t+300-a[i];
if t>100 then
begin
cun:=cun+(t div 100)*100;
t:=t mod 100;
end;
if t<0 then
begin
writeln('-',i);
exit;
end;
end;
t:=t+(cun div 10)*12;
writeln(t);
end. -
02014-11-01 22:33:57@
各位要小心,不要直接*1.2
-
02014-11-01 22:33:35@
#include<stdio.h>
#include<stdlib.h>
int main()
{
//freopen("t1.txt","r",stdin);
int a[12],i,ret=0,tmp,cunkuan=0,dangqian=0;
for(i=0;i<12;i++) scanf("%d",&a[i]);
for(i=0;i<12;i++)
{
dangqian=dangqian+300-a[i];
tmp=dangqian/100;
if(dangqian<0){ret=(i+1)*-1;break;}
else if(tmp>0)
{
cunkuan+=tmp*100;
dangqian=dangqian%100;
}
ret=cunkuan+cunkuan/5+dangqian;
}
printf("%d",ret);
return 0;
} -
02014-08-19 10:27:01@
c++的童鞋注意一下
在计算tot*=1.2的时候要注意精度问题
要写成
tot=(tot+0.5)*1.2 -
02014-07-01 20:52:25@
各位大虾帮忙看一看,这是哪里错了呢:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
int a[12];
for (i=1;i<=12;i++) { scanf("%d",&a[i]); }
int q=0;
int cq=0;
int f=0;
for (i=1;i<=12;i++) {
q=q+300;
if (q<a[i])
{
q=q-a[i];
printf("-%d\n",i);
f=1;
break;
}
else
{ cq=cq+(q-a[i])/100*100; q=q-(q-a[i])/100*100-a[i]; }
}
if (f!=0) { } else
{
q=q+cq+cq/5;
printf("%d\n",q);
}
system("pause");
return 0;
} -
02014-01-02 20:21:17@
。。。