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

水题

Posted by zxyxmu at 2012-12-18 19:58:39 on Problem 2673
#include<iostream>
using namespace std;
struct Node{
 double dis,speed,need;
};
Node nodes[1010];
int big,v;
int main(){
 while(scanf("%d%d",&big,&v)!=EOF){
  int number;
  scanf("%d",&number);
  if(number==0){
   printf("%d\n",big*v);
   continue;
  }
  int i;
  double need=100000000;
  for(i=1;i<=number;i++){
   scanf("%lf%lf",&nodes[i].dis,&nodes[i].speed);
   nodes[i].need=nodes[i].dis/nodes[i].speed;
   if(nodes[i].need<need){
    need=nodes[i].need;
   }
  }
  if(need>big){
   printf("%d\n",big*v);
  }else{
   if(need-(int)need==0){
    need=(int)(need-1);
    if(need==0){
     printf("0\n");
    }else{
     big=(big-need)/2+need;
     printf("%d\n",big*v);
    }
   }else{
    need=(int)need;
    if(need==0){
     printf("0\n");
    }else{
     big=(big-need)/2+need;
     printf("%d\n",big*v);
    }
   }
  }
 }
 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