自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 [PTA]7-10 计算工资 (15 分)

先判断工龄,再判断工时,嵌套条件。#include<stdio.h>int main(){ int year; int time; float salary = 0; scanf("%d %d",&year,&time); if( year < 5){ if(time > 40){ salary = (time - 40) *45...

2019-01-01 01:15:00 2265

原创 [PTA]7-9 用天平找小球 (10 分)

#include<stdio.h>int main(){ int a, b, c; scanf("%d %d %d",&a,&b,&c); if(a != b && a != c){ printf("A"); }else if(a == c){ printf("B"); }else{ printf("C&

2019-01-01 01:12:38 802

原创 [PTA]7-8 超速判断 (10 分)

同样的简单条件语句,注意输出格式。#include<stdio.h>int main(){ int speed ; scanf("%d",&speed); if(speed > 60){ printf("Speed: %d - Speeding",speed); }else{ printf("Speed: %d - OK",speed); } ...

2019-01-01 01:11:15 1421

原创 [PTA]7-7 12-24小时制 (15 分)

if语句控制三个输出。#include <stdio.h>int main(){ int hour,minute; scanf("%d:%d",&hour,&minute); if(hour > 12){ printf("%d:%d PM",hour-12,minute); }else if(hour == 12){ printf("%d:...

2019-01-01 01:10:05 1803

原创 [PTA]7-6 混合类型数据格式化输入 (5 分)

#include <stdio.h>int main(){ float f1,f2; int i; char c; scanf("%f %d %c %f",&f1,&i,&c,&f2); printf("%c %d %.2f %.2f",c,i,f1,f2); return 0;}

2019-01-01 01:08:52 1737 1

原创 [PTA]7-5 表格输出 (5 分)

照抄即可。#include<stdio.h>#include<math.h>int main(){ printf("------------------------------------\n"); printf("Province Area(km2) Pop.(10K)\n"); printf("-----------------------...

2019-01-01 01:07:41 833

原创 [PTA]7-4 BCD解密 (10 分)

#include <stdio.h>int main (){ int n; scanf("%d",&n); printf("%d",n / 16 * 10 + n % 16); return 0;}

2019-01-01 01:06:31 510

原创 [PTA]7-3 逆序的三位数 (10 分)

既然是三位数,分别将三个位置求出在反向相加即可。#include<stdio.h>int main(){ int n; scanf("%d",&n); printf("%d",(n % 10) * 100+((n % 100) / 10) * 10+(n / 100)); return 0;}...

2019-01-01 01:04:42 1192

原创 [PTA]7-2 然后是几点 (15 分)

将起始、流逝的时间化成分钟,加起来,在分别同60取余、作除法即可。(题目保证起始结束的时间在一天之内)#include <stdio.h>int main (){ int ts,tp; scanf("%d %d",&ts,&tp); printf("%d",(ts / 100 * 60 + ts % 100 + tp) / 60 * 100 + (ts /...

2019-01-01 01:00:37 1529

原创 [PTA]7-1 厘米换算英尺英寸 (15 分)

比较简单的一道题,照公式求出总英寸数,再分别与12作除、取余即可。此题英寸与英尺均是整形。#include <stdio.h>int main()//metre=(foot+inch/12)*0.3048{ int centimeter,totalinch; scanf("%d",&centimeter); totalinch = centimeter/30.48...

2019-01-01 00:56:56 2035

原创 [PTA]7-38 数列求和-加强版 (20 分)

基本思路:1.因为0≤N≤1000000\leq N\leq 1000000≤N≤100000,因此最大数可以达到101010万位,因此考虑用数组解决问题;2.构造一个新的数组用来存储数列和的每一位,简单观察可知数列求和有如下规律:第iii位是N−iN-iN−i个AAA相加,因此个位是NA10\frac{NA}{10}10NA​的余数,NA10\frac{NA}{10}10NA​的值进位。3...

2018-12-31 14:34:01 4036 2

原创 [PTA]6-12 判断奇偶性 (10 分)

这道题很简单,奇偶判别函数只需要输出1,0。思路是直接让N除2取余,返回此值的非即可。(奇数除2余1取非为0,偶数除2余0取非为1。)#include <stdio.h>int even( int n );int main(){ int n; scanf("%d", &n); if (even(n)) printf..

2018-12-31 12:04:36 3104

原创 [PTA]7-22 龟兔赛跑(20分)

[PTA]7-22 龟兔赛跑(20分)C语言的龟兔赛跑问题,用的办法比较笨,逻辑应该还算清晰。#include <stdio.h>int main(){ int RabbitDistance,T,time=0;//time在这里计数,以10位单位,每10分钟检查一次龟兔的距离。 scanf("%d",&T); if(T <= 10){ printf("...

2018-12-30 16:55:31 1921

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除