自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Eroslol的博客

编程新手学习笔记

  • 博客(108)
  • 收藏
  • 关注

原创 P1131 最小公倍数和最大公约数问题

描述输入二个正整数x0,y0(2≤x0≤100000,2≤y0≤1000000),求出满足下列条件的P、Q的个数。条件:1.P、Q是正整数2.要求P、Q以xO为最大公约数,以yO为最小公倍数。试求,满足条件的所有可能的两个正整数的个数。格式输入格式两个正整数输出格式满足条件的所有可能的两个正整数的个数样例1

2016-08-31 14:34:14 883

原创 P1113 不高兴的津津

描述津津上初中了。妈妈认为津津应该更加用功学习,所以津津除了上学之外,还要参加妈妈为她报名的各科复习班。另外每周妈妈还会送她去学习朗诵、舞蹈和钢琴。但是津津如果一天上课超过八个小时就会不高兴,而且,上得越久就会越不高兴。假设津津不会因为其它事不高兴,并且她的不高兴不会持续到第二天。请你帮忙检查一下津津下周的日程安排,看看下周她会不会不高兴;如果会的话,哪天最不高兴。格式

2016-08-31 14:12:57 3384

原创 P1103 校门外的树

描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。 已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端

2016-08-31 13:20:20 489

原创 P1102 陶陶摘苹果

#include#includeusing namespace std;int main(){ vector v; int n, m = 10, h, num = 0; while (m--&&cin >> n) v.push_back(n); cin >> h; for (auto c : v) if (h + 30 >= c) num++; cout << nu

2016-08-31 13:00:15 333

原创 P1001 谁拿了最多奖学金

题目有点长,慢慢读#include#include#include#include#includeusing namespace std;int main(){ int n, s1, s2, pa, sum, sum1=0,sum2=0; char xs, xb; string s, ss; while (cin >> n) { while (n--&&cin >

2016-08-31 11:31:55 870

原创 P1000 A+B Problem

背景for beginners,特设此题,^_^描述输入两个自然数,输出他们的和格式输入格式两个自然数x和y 0=x,y=327670输出格式一个数,即x和y的和样例1样例输入1[复制]123 500样例输出1[复制]623#i

2016-08-31 09:46:55 406

原创 1462 素数和

#include#includeusing namespace std;bool sushu(int m){ for (int i = 2;i<=sqrt(m);i++) if (m % i == 0) return 0; return 1;}int main(){ int a, b,sum,t; while (cin >> a >> b) { if (a >

2016-08-31 09:43:51 324

原创 1461 手机

#include#includeusing namespace std;int main(){ int sum = 0; string s; while (getline(cin, s)) { for (int i = 0; i <= s.size() - 1; i++) { if (s[i] == ' '||s[i] == 'a' || s[i] == '

2016-08-30 16:27:26 323

原创 1459 n个数的最小公倍数

求出最大公约数后可用公式求最小公倍数也可以做#include#include#includeusing namespace std;int main(){ int n, val, num = 0, m; vector v; while (cin >> n) { m = n; while (m--&&cin >> val) v.push_back(val); }

2016-08-30 16:14:20 329

原创 1447 取出整数的一部分

用字符串类型string来处理数字#include#include#includeusing namespace std;int main(){ int k; string s, s1, s2; while (cin >> s >> k) { if (abs(k) > s.size()) { cout << "Error" << endl; contin

2016-08-30 15:30:55 546

原创 1449 求阶乘

#includeusing namespace std;int main(){ int n,sum; while (cin >> n) { sum = 1; for (int i = n; i >= 1; i--) { sum *= i; } cout << sum << endl; } return 0;}

2016-08-30 14:18:20 323

原创 1007 级数求和

#includeusing namespace std;int main(){ double sum; int k; while (cin >> k) { sum = 0; for (double i = 1;; i++) { sum += 1 / i; if (sum > k) { cout << i; break; } }

2016-08-30 13:48:49 385

原创 1395 求一个整数有几位

用字符串来处理数字#include#includeusing namespace std;int main(){ string s; while (cin >> s) { cout << s.size() << endl; } return 0;}

2016-08-30 13:41:49 445

原创 1439 统计素数个数

#include#includeusing namespace std;bool sushu(int n){ for (int i = 2; i <= sqrt(n); i++) if (n%i == 0) return 0; return 1;}int main(){ int l, r,num; while (cin >> l >> r) { num = 0;

2016-08-30 13:23:56 341

原创 1430 素数判定

质数又称素数。指在一个大于1的自然数中,除了1和此整数自身外,不能被其他自然数整除的数。素数在数论中有着很重要的地位。比1大但不是素数的数称为合数。1和0既非素数也非合数。质数是与合数相对立的两个概念,二者构成了数论当中最基础的定义之一。基于质数定义的基础之上而建立的问题有很多世界级的难题,如哥德巴赫猜想等。算术基本定理证明每个大于1的正整数都可以写成素数的乘积,并且这种乘积的形式是唯一的。这

2016-08-30 13:16:04 773

原创 1313 质因数分解

#include#includeusing namespace std;bool sushu(long m){ for (long i = 2; i <= sqrt(m); i++) { if (m%i == 0) return 0; } return 1;}int main(){ long n; while (cin >> n) { for (int

2016-08-30 11:02:12 1055

原创 1276 图标缩放

#includeusing namespace std;int main(){ int k; while (cin >> k) { for (int j = 1; j <= k; j++) { for (int i = 1; i <= k; i++) cout << '*'; for (int i = 1; i <= k; i++) cout <<

2016-08-30 10:38:17 407

原创 1275 有鱼的声音

#includeusing namespace std;int main(){ int n1, n2, n3, n4; while (cin >> n1 >> n2 >> n3 >> n4) { if (n1 < n2&&n2 < n3&&n3 < n4) cout << "Fish Rising" << endl; else if (n1>n2&&n2>n3&&n3>

2016-08-30 10:22:34 485

原创 1274 不好玩的罚金

注意输出的格式(空格)。#includeusing namespace std;int main(){ int limit; cout << "Enter the speed limit:" << ' '; cin >> limit; int speed; cout << "Enter the recorded speed of the car:" << ' '; cin

2016-08-30 10:16:53 480

原创 1206 保留两位小数

#include#includeusing namespace std;int main(){ double m; while (cin >> m) { cout << fixed << setprecision(2) << m << endl; } return 0;}

2016-08-29 14:37:23 495

原创 1205 单词翻转

#include#include#includeusing namespace std;int main(){ string s,s1; vector v; while (cin >> s) { v.push_back(s); } for (int i = v.size() - 1; i >= 0; i--) { s1 += v[i]+' ';//注意加空格隔开每

2016-08-29 14:25:54 428

原创 1204 寻找子串位置

#include#includeusing namespace std;int main(){ string a,b; int flag; while (cin >> a >> b) { for (int i = 0; i <= a.size() - 1; i++) { flag = 0; if (a[i] == b[0]) { for (int

2016-08-29 13:54:06 498

原创 1203 判断浮点数是否相等

1、abs和fabs,abs是对整数取绝对值,而fabs是对浮点数取绝对值。2、函数原型:int abs(int x)double fabs(double x)3.1e-8 表示的数据是 1*10的负8次方,很小数值0.00000001。4.我们一般认为两个浮点数相等,当且当他们之间的误差不超过1e-8。#include#includeusing namespace s

2016-08-29 13:36:44 502

原创 1202 求和

#includeusing namespace std;int main(){ int n, m,sum=0; while (cin >> n) { while (n--&&cin >> m) { sum += m; } cout << sum << endl; } return 0;}

2016-08-29 13:30:04 464

原创 1201 最小数和最大数

#include#include#includeusing namespace std;int main(){ vector v; int n,m; while (cin >> n) { while (n--&&cin >> m) { v.push_back(m); } sort(v.begin(), v.end()); cout << v[0] <<

2016-08-29 13:28:00 441

原创 1071 Hello World

#includeusing namespace std;int main(){ cout << "Hello World" << endl; return 0;}

2016-08-29 13:23:47 326

原创 1057 津津的储蓄计划

#include#includeusing namespace std;int main(){ vector v; int n,num = 12,sh=0,ch=0; while (num--&&cin >> n) { v.push_back(n); } for (int i = 0; i <= 11; i++) { sh = sh+300- v[i]; if

2016-08-29 13:21:59 1805

原创 1023 GPA计算

#include#includeusing namespace std;int main(){ int n,m,i,p; double s,g,sum; while (cin >> n) { sum =p= 0; i = n; while (i--&&cin >> m>>s) { p += m; sum += m*s; } cout << fi

2016-08-29 12:59:52 602

原创 1000 A+B问题

题目描述Description输入两个整数A和B,输出他们的和输入描述InputDescription 输入为一行,包含两个整数A,B。数据保证A与B都在2^31-1的范围内输出描述OutputDescription 输入A与B的和,数据保证A与B的和在2^31-1的范围内样例输入SampleInput 1 3样例输出Sample

2016-08-29 12:47:13 881

原创 31 5个数求最值

描述 设计一个从5个整数中取最小数和最大数的程序输入输入只有一组测试数据,为五个不大于1万的正整数输出输出两个数,第一个为这五个数中的最小值,第二个为这五个数中的最大值,两个数字以空格格开。样例输入1 2 3 4 5样例输出1 5#include#include#includeusing namespace std;int main

2016-08-26 16:51:52 388

原创 22 素数求和问题

描述 现在给你N个数(0),现在要求你写出一个程序,找出这N个数中的所有素数,并求和。输入第一行给出整数M(0代表多少组测试数据每组测试数据第一行给你N,代表该组测试数据的数量。接下来的N个数为要测试的数据,每个数小于1000输出每组测试数据结果占一行,输出给出的测试数据的所有素数和样例输入351 2 3 4 5811 12 13

2016-08-26 16:37:33 502

原创 13 Fibonacci数

描述 有一个整型偶数n(2你要做的是:先把1到n中的所有奇数从小到大输出,再把所有的偶数从小到大输出。输入第一行有一个整数i(2表示有 i 组测试数据;每组有一个整型偶数n。输出第一行输出所有的奇数第二行输出所有的偶数样例输入21014样例输出1 3 5 7 92 4 6 8 101 3 5 7 9 11

2016-08-26 15:37:56 459

原创 11 奇偶数分离

描述 有一个整型偶数n(2你要做的是:先把1到n中的所有奇数从小到大输出,再把所有的偶数从小到大输出。输入第一行有一个整数i(2表示有 i 组测试数据;每组有一个整型偶数n。输出第一行输出所有的奇数第二行输出所有的偶数样例输入21014样例输出1 3 5 7 92 4 6 8 10 1 3 5 7 9 11

2016-08-26 15:30:45 455

原创 4 ASCII码排序

ASCII码排序时间限制:3000 ms  | 内存限制:65535 KB难度:2描述 输入三个字符(可以重复)后,按各字符的ASCII码从小到大的顺序输出这三个字符。输入第一行输入一个数N,表示有N组测试数据。后面的N行输入多组数据,每组输入数据都是占一行,有三个字符组成,之间无空格。输出对于每组输入数据,输出一行,字符中间用一个空格分开。

2016-08-26 15:19:24 753

原创 1 A+B Problem

描述 此题为练手用题,请大家计算一下a+b的值输入输入两个数,a,b输出输出a+b的值样例输入2 3样例输出5#includeusing namespace std;int main(){ int a, b; cin >> a >> b; cout << a + b << endl; return 0;}

2016-08-26 14:47:06 526

原创 1235 统计同成绩学生人数

#include#includeusing namespace std;int main(){ int n,m,score,num; vector v; while (cin >> n) { while (n--&&cin >> m) { v.push_back(m); } cin >> score; num = 0; for (auto c:v)

2016-08-26 14:29:17 445

原创 1097 A hard puzzle

#includeusing namespace std;int main(){ long a, b, val; while (cin >> a >> b) { a= a%10; val = 1; for (int i = 1;i<=b; ++i) { val*=a; val%=10; } cout << val << endl; } retur

2016-08-22 13:12:05 241

原创 1076 An Easy Task

#includeusing namespace std;int main(){ int t,y,n,num,year; while (cin >> t) { while (t--&&cin >> y >> n) { num = 0; for (int i = y;; ++i) { if ((i % 4 == 0 && i % 100 != 0) ||

2016-08-22 12:52:07 248

原创 1061 Rightmost Digit

#includeusing namespace std;int main(){ int t,m; long n; while (cin >> t) { while (t--&&cin >> n) { if (n > 10) m = n % 10; else m = n; m = pow(m, n); m = m % 10; cout <

2016-08-22 12:15:09 195

原创 1040 As Easy As A+B

#include#include#includeusing namespace std;int main(){ int t; vector v; while (cin >> t) { int n; while (t--&&cin >> n) { int val; while (n--&&cin >> val) v.push_back(val);

2016-08-19 14:27:28 216

空空如也

空空如也

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

TA关注的人

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