算法练习
虽然不参与ACM。。不过做些算法练习也好...http://acm.zju.edu.cn/show_problem.php?pid=1001#include < iostream >
using namespace std;
int main(){
int a,b;
while(cin>>a>>b){
cout<<a+b<<endl;
}
return 0;
}http://acm.pku.edu.cn/JudgeOnline/problem?id=1000#include < iostream >
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}
[ 本帖最后由 onttpi 于 2008-4-17 17:49 编辑 ]
TOJ打不开。。。
又搜了一次如何对C++中的输出小数位进行控制。。
http://acm.zju.edu.cn/show_problem.php?pid=1048
#include < iostream >
#include < iomanip >
using namespace std;
int main(){
double i,k=0.0;
for(int j=0;j<12;++j){
cin>>i;
k+=i/12;
}
cout<<setprecision(2)<<setiosflags(ios::fixed);
cout<<"$"<<k<<endl;
return 0;
}
[ 本帖最后由 onttpi 于 2008-4-17 16:14 编辑 ] 竟然看成Q
yin者见yin..
页:
[1]