扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
第一部分数据类型、运算符和表达式
创新互联是一家专注于网站设计、网站建设与策划设计,南谯网站建设哪家好?创新互联做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:南谯等地区。南谯做网站价格咨询:18980820575格式为:序号-ACWing题目序号-题目名称
ps:题目过于简单,不做详细描述,如需要请按序号自搜
题解仅本人拙见,如有错误或更好的解题方式请后台私信我
#includeusing namespace std;
int add(int a,int b,int c ,int d)
{int txt;
txt=a*b-c*d;
return txt;
}
int main()
{int a,b,c,d,count;
cin>>a>>b>>c>>d;
count= add(a,b,c,d);
cout<<"DIFERENCA = "<
002-604圆的面积#include#include#define D 3.14159
using namespace std;
int main(){double r,l;
scanf("%lf",&r);
l=D*r*r;
//cout<<"A="<
003-606平均数#includeusing namespace std;
int main()
{double a,b,c;
scanf("%lf%lf",&a,&b);
c=(a*3.5+b*7.5)/11;
printf("MEDIA = %.5lf",c);
return 0;
}
004-609工资#include#include#define D 3.14159
using namespace std;
int main(){int a,b;
float c,d;
scanf("%d%d\n",&a,&b);
scanf("%f",&c);
if(a>=1&&a<=100&&b>=1&&b<=200&&c>=1&&c<=50){ printf("NUMBER = %d\n",a);
d=b*c;
printf("SALARY = U$ %.2f",d);
}
}
005-616两点间距离#include#include#include#define D 3.14159
using namespace std;
int main(){double a,b,c,d,e;
scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
e=sqrt((c-a)*(c-a)+(d-b)*(d-b));
printf("%.4lf",e);
}
006-653钞票#include#include#include#define D 3.14159
using namespace std;
int main(){int n,a1,a2,a3,a4,a5,a6,a7,a8;
cin>>n;
a1=n/100;
a2=(n-a1*100)/50;
a3=(n-a1*100-a2*50)/20;
a4=(n-a1*100-a2*50-a3*20)/10;
a5=(n-a1*100-a2*50-a3*20-a4*10)/5;
a6=(n-a1*100-a2*50-a3*20-a4*10-a5*5)/2;
a7=(n-a1*100-a2*50-a3*20-a4*10-a5*5-a6*2)/1;
printf("%d\n",n);
printf("%d nota(s) de R$ 100,00\n",a1);
printf("%d nota(s) de R$ 50,00\n",a2);
printf("%d nota(s) de R$ 20,00\n",a3);
printf("%d nota(s) de R$ 10,00\n",a4);
printf("%d nota(s) de R$ 5,00\n",a5);
printf("%d nota(s) de R$ 2,00\n",a6);
printf("%d nota(s) de R$ 1,00\n",a7);
}
007-654时间转换#include#include#include#define D 3.14159
using namespace std;
int main(){int m,n;
cin>>m;
printf("%d:%d:%d",m/3600,(m-m/3600*3600)/60,m%60);
return 0;
}
008-605简单乘积#include#include#include#define D 3.14159
using namespace std;
int main(){int m,n;
cin>>m>>n;
printf("PROD = %d",m*n);
return 0;
}
009-611简单计算#include#include#include#define D 3.14159
using namespace std;
int main(){int a,b,e,f;
double c,g;
scanf("%d%d%lf\n",&a,&b,&c);
scanf("%d%d%lf",&e,&f,&g);
printf("VALOR A PAGAR: R$ %.2lf",b*c+f*g);
return 0;
}
010-612球的面积#include#include#include#define D 3.14159
using namespace std;
int main(){int n;
double m;
scanf("%d",&n);
m=(4/3.0)*D*pow(n,3);
printf("VOLUME = %.3lf",m);
return 0;
}
011-613面积#include#include#include#define D 3.14159
using namespace std;
int main(){double a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
printf("TRIANGULO: %.3lf\n",a*c/2);
printf("CIRCULO: %.3lf\n",D*c*c);
printf("TRAPEZIO: %.3lf \n",(a+b)*c/2);
printf("QUADRADO: %.3lf\n",pow(b,2));
printf("RETANGULO: %.3lf\n",a*b);
return 0;
}
012-607平均数2#include#include#include#define D 3.14159
using namespace std;
int main(){double a,b,c,d;
scanf("%lf%lf%lf",&a,&b,&c);
d=(a*2+b*3+c*5)/10;
printf("MEDIA = %.1lf",d);
return 0;
}
013-610工资和奖金#include#include#include#define D 3.14159
using namespace std;
int main(){char a[10];
int b,e,f;
double c,g;
scanf("%s%lf%lf",&a,&c,&g);
// scanf("%d%d%lf",&e,&f,&g);
printf("TOTAL = R$ %.2lf",c+0.15*g);
return 0;
}
014-614大值#include#include#include#define D 3.14159
using namespace std;
int remax(int a,int b,int c)
{int a1,a2,a3;
a1=(a+b+abs(a-b))/2;
a2=(a+c+abs(a-c))/2;
a3=(c+b+abs(c-b))/2;
if(a1>=a2)
return a1;
else if(a2>>a3)
return a2;
else if(a3>=a1)
return a3;
}
int main(){int a,b,c,max;
cin>>a>>b>>c;
max=remax(a,b,c);
printf("%d eh o maior",max);
return 0;
}
015-617距离#include#include#include#define D 3.14159
using namespace std;
int main(){int a;
double b;
cin>>a;
b=a/30.0*60;
printf("%.0lf minutos",b);
return 0;
}
016-618燃料消耗(longlong取地址)#include#include#include#define D 3.14159
using namespace std;
int main(){long long int a;
long long int b;
long double c;
scanf("%I64d%I64d",&a,&b);
c=a*b/12.0;
printf("%.3Lf",c);
return 0;
}
017-656钞票和硬币#include#include#include#define D 3.14159
using namespace std;
int main(){int years;
cin>>years;
printf("ano(%d)\n",years/365);
printf("mes(%d)\n"years/12*30,);
printf("dia(%d)\n",years%30);
return 0;
}
018-655天数转换#include#include#include#define D 3.14159
using namespace std;
int main(){int years,months,days;
cin>>years;
months=ceil((years-years/365*365)/30);
days=(years-years/365*365)%30;
printf("%d ano(s)\n",years/365);
printf("%d mes(es)\n",months);
printf("%d dia(s)\n",days);
return 0;
}
019-615油耗#include#include#define D 3.14159
using namespace std;
int main(){int a;
float b,c;
scanf("%d%f",&a,&b);
c=a/b;
printf("%.3f ",c);
printf("km/l");
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流