做法分析
按照题目所给提示模拟操作计算即可。注意计算过程中如果全为整数类型就加个 double( int等整数类型 ),或者乘上 转成 double。
AC Code
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,v,a;
cin>>n>>t;
cout<<fixed<<setprecision(2);
while(n--){
cin>>v>>a;
cout<<v*t+0.5*a*t*t<<" "<<v*1.0+a*t<<"\n";
}
}