随笔分类 - C++ / 信息学奥赛刷题
摘要:#include <iostream> using namespace std; int main(){ int n; cin>>n; int x[n+5]; for(int i = 1;i<=n;i++){ cin>>x[i]; } for(int i = 1;i<=n;i++){ if(x[i]
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int main() { long n,sum = 0;//次数 总钱数 cin>>n;//输入 long x,m,s;//方式 价格 时间 vector<long> m1,s1;//存储地铁的优惠券 boo
阅读全文
摘要:#include <iostream> using namespace std; int main(){ int n; cin>>n; int y = 0,y1 = 0; while(n){ y++; if((n-1)%3==0 && y1==0){ y1 = y; } if(n%3==0){ n
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; //char a[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; char a[16] = {'0','1',
阅读全文
摘要:#include <iostream> using namespace std; int main() { int N,sum = 0; cin>>N; int a[N]; for(int i = 0;i<N;i++){ cin>>a[i]; } for(int i = 0;i<N;i++){ fo
阅读全文
摘要:1061:求整数的和与均值 时间限制: 1000 ms 内存限制: 65536 KB提交数: 119446 通过数: 59245 【题目描述】 读入n(1≤n≤10000)个整数,求它们的和与均值。 【输入】 输入第一行是一个整数n,表示有n个整数。 第2~n+1行每行包含1个整数。每个整数的绝对值
阅读全文
摘要:1059:求平均年龄 时间限制: 1000 ms 内存限制: 65536 KB提交数: 124702 通过数: 73344 【题目描述】 班上有学生若干名,给出每名学生的年龄(整数),求班上所有学生的平均年龄,保留到小数点后两位。 【输入】 第一行有一个整数n(1<= n <= 100),表示学生的
阅读全文
摘要:1075:药房管理 时间限制: 1000 ms 内存限制: 65536 KB提交数: 66376 通过数: 39350 【题目描述】 随着信息技术的蓬勃发展,医疗信息化已经成为医院建设中必不可少的一部分。计算机可以很好地辅助医院管理医生信息、病人信息、药品信息等海量数据,使工作人员能够从这些机械的工
阅读全文
摘要:1077:统计满足条件的4位数 时间限制: 1000 ms 内存限制: 65536 KB提交数: 58633 通过数: 40162 【题目描述】 给定若干个四位数,求出其中满足以下条件的数的个数:个位数上的数字减去千位数上的数字,再减去百位数上的数字,再减去十位数上的数字的结果大于零。 【输入】 输
阅读全文
摘要:1080:余数相同问题 时间限制: 1000 ms 内存限制: 65536 KB提交数: 54905 通过数: 36115 【题目描述】 已知三个正整数a,b,c。现有一个大于1的整数x,将其作为除数分别除a,b,c,得到的余数相同。 请问满足上述条件的x的最小值是多少?数据保证x有解。 【输入】
阅读全文
摘要:【题目描述】 自然数a的因子是指能整除a的所有自然数,但不含a本身。例如12的因子为:1,2,3,4,6。若自然数a的因子之和为b,而且b的因子之和又等于a,则称a,b为一对“亲和数” 。求最小的一对亲和数(a<>b)。 #include <iostream> using namespace std
阅读全文
摘要:#include <iostream> using namespace std; int main() { int a,b,c; cin>>a>>b; if(a>=10 || b>=20){ cout<<1; }else{ cout<<0; } return 0; }
阅读全文