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 |
Re:最近总是16ms,做法都一样,不知道问题在哪,是不是我代码风格不好...In Reply To:Re:最近总是16ms,做法都一样,不知道问题在哪,是不是我代码风格不好... Posted by:CCUT2015_wangzhao at 2015-03-18 20:30:14 > 如果你是c++ 试试 用scanf 和 printf 别用 cin cout 这题亲测用cin cout 0ms #include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int jf = 0; while(1){ string from, to; int dist; char dj; cin >> from; if(from == "#") break; if(from == "0"){ cout << jf << endl; jf = 0; } else{ cin >> to >> dist >> dj; if(dj == 'F'){ jf += 2 * dist; } else if(dj == 'B'){ jf += (dist + (dist+1)/2); } else{ jf += ((dist > 500) ? dist : 500); } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator