![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
信息学奥赛
莫莫事
这个作者很懒,什么都没留下…
展开
-
2030:【例4.16】找素数
#include<bits/stdc++.h>using namespace std;int gaoji(int mn){ for (int j = 2; j <= sqrt(mn); j++) if (mn % j==0) return 0; return 1;}int main(){ int a, b; cin >> a >> b; for (int i = a; i <= b; i++) { if (i=...原创 2021-11-28 10:50:12 · 850 阅读 · 0 评论 -
1084:幂的末尾
#include <iostream>#include <cmath>#include <cstdio>using namespace std;int main (void){ int a,b; cin>>a; cin>>b; int r=1; for(int i=0;i<b;++i) { r=r*a%1000; } printf("%03d",r);.原创 2021-10-28 13:41:04 · 327 阅读 · 0 评论 -
1077:统计满足条件的4位数
#include <iostream>#include <cstdio>using namespace std;int main(void){ int n = 0;//n个数 cin >> n; int a = 0;//保存个位 int b = 0;//保存十位 int c = 0;//保存百位 int d = 0;//保存千位 int count = 0;//四位数 int ans = 0;//减去后的结果 int sum = 0;//保存个.原创 2021-10-22 13:22:01 · 483 阅读 · 0 评论 -
1066:满足条件的数累加
嗯,怎么说呢,这道题还简单的吧,看代码:#include <bits/stdc++.h>using namespace std;int main(void){ int k = 0; cin >> k; int cishuyi = 0; int cishushi = 0; int cishuwu = 0; int a[1000]; for (int i = 1; i <= k; ++i) { cin >> a[i]; } for (原创 2021-10-16 16:36:24 · 182 阅读 · 0 评论 -
1063:最大跨度值
#include <iostream>#include <cstdio>using namespace std;int main(void){ int a[1001]; int n = 0; int xiao = 0; int da = 9999; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; if (a[i > da]) da = a[i]; .原创 2021-10-15 13:14:06 · 352 阅读 · 0 评论 -
1058:求一元二次方程
#include <cstdio>#include <cmath>#define eps1 1e-10#define eps2 1e-6using namespace std;int main(){ double a,b,c,x1,x2,g; scanf("%lf%lf%lf",&a,&b,&c); g=b*b-4*a*c; if(g<0&&fabs(g)>eps1)printf("No.原创 2021-10-07 17:47:38 · 137 阅读 · 0 评论 -
1055:判断闰年
1055:判断闰年#include <iostream>using namespace std;int main (void){ int a=0; cin>>a; if((a%4==0 && a%100==0)|| (a%400==0)) { cout<<"Y"<<endl; } else { cout<<"N"<<原创 2021-10-02 10:46:00 · 210 阅读 · 0 评论 -
2059:【例3.11】买笔
2059:【例3.11】买笔#include <iostream>#include <cstdio>using namespace std;int main (void){ int a,b,c,y,x; cin>>x; c=x/4; y=x%4; switch (y) { case 1: a=0; b=0; case 2 : a=0; b=1; c--; case原创 2021-09-30 13:01:46 · 545 阅读 · 0 评论 -
1048:有一门课不及格的学生
#include<iostream>using namespace std;int main(){ int chinese,math; cin>>chinese>>math; if( (chinese>=60&&math<60) || (math>=60&&chinese<60) ) cout<<1<<endl; else cout<<0&l.原创 2021-09-28 12:47:55 · 76 阅读 · 0 评论