Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:最近总是16ms,做法都一样,不知道问题在哪,是不是我代码风格不好...

Posted by KatrineYang at 2016-09-12 03:56:19 on Problem 1326
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator