| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
大家看看,我的程序怎么回事????In Reply To:Re:You can assume it is in a reasonable range. Posted by:Bedivere at 2007-07-24 14:00:42 # include <iostream.h>
# include <string.h>
# include <stdio.h>
int kk=1;
int main()
{
long n,l,m,car;
char s[8];
int i=0;
char ss;
long count;
cin>>n;
while(n--)
{
cin>>l>>m;
l*=100;
long lei=0;
long flag=0;
ss='l';/////////////
count=0;
long mm=m;//////////////
//++m;
while(m)
{
cin>>car>>s;
if(ss!=s[0] && mm==m)
{
ss='r';
//lei+=car;
flag=1;//////////////
}
if(ss==s[0])
{
lei+=car;
if(m==1)
{
long yu=lei%l;
if(yu)
count+=2*(lei/l+1)-1;
else
count+=2*(lei/l)-1;
if(flag)////////////////////////
count++;
ss=s[0];
//lei=car;
flag=0;
}
}
else
{
long yu=lei%l;
if(yu)
count+=2*(lei/l+1)-1;
else
count+=2*(lei/l)-1;
if(flag)////////////////////////
count++;
ss=s[0];
lei=car;
flag=0;
}
m--;
}
cout<<++i<<"\t"<<count<<"\n";
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator