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 |
这代码,我自己都不知道自己写的啥?要错就错,别来RUNTIME ERROR啊#include<iostream> #include<cmath> using namespace std; struct node { int s; int t; int r; int time; }a[1001]; int main() { int n,k,i; int ys,sx,sj,mid; cin>>n>>k; for(i=0;i<k;i++) cin>>a[i].s>>a[i].t>>a[i].r; for(i=0;i<k;i++) { ys=n/(a[i].s*a[i].t); sx=n%(ys*a[i].s*a[i].t); sj=ys*(a[i].r+a[i].t); mid=ceil((double)sx/(double)a[i].s); sj+=mid; if(mid==0) a[i].time=(int)(sj)-a[i].r; else a[i].time=(int)(sj); } for(i=0;i<k;i++) cout<<a[i].time<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator