POJ 1326
1 #include<iostream> 2 #include<string> 3 using namespace std; 4 int main(){ 5 string original_city=" "; 6 string distance_city=" "; 7 int length; 8 char code; 9 int sum=0; 10 do{ 11 do{ 12 cin>>original_city; 13 if(original_city=="0") 14 break; 15 if(original_city=="#") 16 return 0; 17 cin>>distance_city; 18 cin>>length; 19 /*if(length<=0) 20 return 0;*/ 21 cin>>code; 22 switch(code){ 23 case 'F':length*=2;break; 24 case 'B':length+=(length+1)/2;break; 25 case 'Y':switch(length<=500){ 26 case 1:length=500;break; 27 case 0:break; 28 }break; 29 } 30 sum+=length; 31 }while(1); 32 cout<<sum<<endl; 33 sum=0; 34 }while(1); 35 36 }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com