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:这道题可以不用数组——附代码

Posted by juruo_zzt at 2020-04-30 08:03:38 on Problem 2017
In Reply To:这道题可以不用数组——附代码 Posted by:rubbishMD at 2016-04-20 22:08:06
> #include<iostream>
> using namespace std;
> int main(){
> 	int a,b,tot,n,last;
> 	cin>>n;
> 	while(n!=-1)
> 	{
> 		last=tot=0;
> 		for(int i=0;i<n;i++)
> 		{
> 			cin>>a>>b;
> 			tot=tot+(b-last)*a;
> 			last=b;
> 		}
> 		cout<<tot<<" miles"<<endl;
> 		cin>>n;
> 	}
> 	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