| ||||||||||
| 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:这道题可以不用数组——附代码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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator