POJ 2336
#include <iostream> using namespace std; int main() { //freopen("acm.acm","r",stdin); int test; int n; int t; int m; int odd; int mul; int i; int j; int time; int time_1; cin>>test; while(test --) { cin>>n; cin>>t; cin>>m; mul = m / n; odd = m % n; time_1 = 0; if(odd != 0) { for(i = 0; i < odd; ++ i) { cin>>time; } time_1 = time + 2*t; } // cout<<time_1<<endl; // time_1 for(i = 0; i < mul; ++ i) { for(j = 0; j < n; ++ j) { cin>>time; } if(time < time_1) { time_1 = time_1 + 2*t; } else { time_1 = time + 2*t; } } cout<<time_1-t<<" "<<mul + !(odd == 0)<<endl; } }