#include<iostream>usingnamespace std;intmain(){int a, b;
cin>>a>>b;
cout<<a+b<<"
";return0;}
02: 计算(a+b)*c的值
#include<iostream>usingnamespace std;intmain(){int a, b, c;
cin>>a>>b>>c;
cout<<(a+b)*c<<"
";return0;}
03:计算(a+b)/c的值
#include<iostream>usingnamespace std;intmain(){int a, b, c;
cin>>a>>b>>c;
cout<<(a+b)/c<<"
";return0;}
04: 带余除法
#include<iostream>usingnamespace std;intmain(){int a, b;
cin>>a>>b;
cout<<a/b<<' '<<a%b<<'
';return0;}
05:计算分数的浮点数值
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double a, b;scanf("%lf%lf",&a,&b);double c = a/b;printf("%.9lf",c);return0;}
06:甲流疫情死亡率
#include<cstdio>#include<iostream>usingnamespace std;intmain(){//int a, b;double a, b;scanf("%lf%lf",&a,&b);double c = b/a*100;printf("%.3lf%%",c);return0;}
07: 计算多项式的值
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double x, a, b, c, d;scanf("%lf%lf%lf%lf%lf",&x,&a,&b,&c,&d);double ans = x*x*x*a+b*x*x+c*x+d;printf("%.7lf",ans);return0;}
08:温度表达转化
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double x;scanf("%lf",&x);double ans =5*(x-32)/9;printf("%.5lf",ans);return0;}
#include<cstdio>#include<iostream>usingnamespace std;intmain(){float a, b;scanf("%f%f",&a,&b);float r =1/(1/a +1/b);printf("%.2f",r);return0;}
11:计算浮点数相除的余数
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double a, b;scanf("%lf%lf",&a,&b);int k =0;while(a-k*b >=0){
k++;}
k--;printf("%g",a-k*b);return0;}
12: 计算球的体积
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double x;double pi =3.14;scanf("%lf",&x);printf("%.2lf",4.0*pi*x*x*x/3);return0;}
#include<cstdio>#include<iostream>usingnamespace std;intmain(){double h, r;double pi =3.14;scanf("%lf%lf",&h,&r);
r*=0.01, h *=0.01;double v = pi*r*r*h;double ans =20/(v*1000);printf("%d",(int)(ans-0.0001)/1+1);return0;}
15:苹果和虫子
#include<cstdio>#include<iostream>usingnamespace std;intmain(){int n, x, y;
cin>>n>>x>>y;int b =(int)((y*1.0/x*1.0-0.001)+1);
cout<<n-b<<'
';return0;}
#include<cstdio>#include<iostream>#include<cmath>usingnamespace std;intmain(){double x1, y1, x2, y2, x3, y3;scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);double a =sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));double b =sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));double c =sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));double p =(a+b+c)/2;printf("%.2lf
",sqrt(p*(p-a)*(p-b)*(p-c)));return0;}