| ||||||||||
| 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 | |||||||||
各位大虾帮我看看哪里错了?#include<iostream>
#include<string>
using namespace std;
int main()
{
int i,j;
int t,p,w,time,arr[27]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9,1};
cin>>t;
for(j=0;j<t;j++)
{
time=0;
string a;
cin>>p>>w;
cin.seekg(1);
getline(cin,a);
for(i=0;i<a.size();i++)
{
int temp,s,pre;
temp=(int)(a[i]);
if(a[i]==32) { time+=p;continue;}
temp-=65;
if(temp<18) s=temp%3;
else if(temp==18) s=3;
else
{
if(temp==25) s=3;
else
{
temp--;
s=temp%3;
}
}
time+=(s+1)*p;
if(i)
{
pre=(int)(a[i-1]);
if(pre==32) pre=92;
pre-=65;
if(arr[pre]==arr[temp])time+=w;
}
}
cout<<time<<endl;
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator