L1-051
输入格式:
输入在一行中给出商品的原价(不超过1万元的正整数)和折扣(为[1, 9]区间内的整数),其间以空格分隔。
输出格式:
在一行中输出商品的折扣价,保留小数点后 2 位。
主要思路
a折即 原价*a*0.1
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
double x;
scanf("%d %d",&a,&b);
x=a*b*0.1;
printf("%.2f",x);
return 0;
}
L1-052
输出格式:
在第一行中输出:“2018”;第二行中输出:“wo3 men2 yao4 ying2 !”。
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("2018\n");
printf("wo3 men2 yao4 ying2 !");
return 0;
}
L1-057
输出格式:
在一行中按照样例输出,以惊叹号结尾。
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("PTA shi3 wo3 jing1 shen2 huan4 fa1 !");
return 0;
}
L1-060
输入格式:
输入在一行中给出 2 个不超过 100 的正整数 x 和 y,并且保证有 x>y。这里假设横、纵坐标的最大值(即截止日和最终完成度)都是 100。
输出格式:
在一行中输出心理阴影面积。
友情提醒:三角形的面积 = 底边长 x 高 / 2;矩形面积 = 底边长 x 高。嫑想得太复杂,这是一道 5 分考减法的题……
主要思路
将(x,y)和(100,0)点连接得到两个三角形 心理阴影面积即为矩形面积除以2减去两三角形面积
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned int a,b,c;
scanf("%d %d",&a,&b);
c=100*100/2-b*100/2-(100-a)*100/2;
printf("%d",c);
return 0;
}