当前位置:网站首页>acm入门day1
acm入门day1
2022-07-05 19:09:00 【ANYOUZHEN】
acm网址:【深基7.例2】质数筛 - 洛谷 洛谷网
题目描述:

源代码如下:
#include<stdio.h>
int main()
{
int n, i, j;
int sushu(int n);//定义一个判断素数的函数,如果为素数则返回m的值为1
int a[1000];
printf("please enter a number:");
scanf_s("%d", &n);
for (i = 0; i < n; i++)
scanf_s("%d", &a[i]);
for (i = 0; i < n; i++)
{
if (sushu(a[i]) == 1)
{
printf("%3d", a[i]);
}//输出素数
}
}
int sushu(int j)//素数函数
{
int i; int m;
for (i = 2; i < j; i++)
{
if (j % i == 0)
{
m = 0;
}
else
{
m = 1;
}
return m;
}
}运行成功:

acm入门第一天完成
边栏推荐
- 详解SQL中Groupings Sets 语句的功能和底层实现逻辑
- UDF implementation of Dameng database
- 2022 the latest big company Android interview real problem analysis, Android development will be able to technology
- UWB超宽带定位技术,实时厘米级高精度定位应用,超宽带传输技术
- How to quickly advance automated testing? Listen to the personal feelings of the three bat test engineers
- 什么是面上项目
- How to choose the notion productivity tools? Comparison and evaluation of notion, flowus and WOLAI
- Blue sky drawing bed Apple quick instructions
- What are the reliable domestic low code development platforms?
- 软件测试是干什么的?学习有啥要求?
猜你喜欢
![[today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day](/img/7d/7a01c8c6923077d6c201bf1ae02c8c.png)
[today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day

14、用户、组和权限(14)

Summer Challenge database Xueba notes, quick review of exams / interviews~
How MySQL queries and modifies JSON data

Advanced application of C # language

全网最全的低代码/无代码平台盘点:简道云、伙伴云、明道云、轻流、速融云、集简云、Treelab、钉钉·宜搭、腾讯云·微搭、智能云·爱速搭、百数云

测试外包公司怎么样?
PHP uses ueditor to upload pictures and add watermarks

Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered

国内低代码开发平台靠谱的都有哪些?
随机推荐
Fundamentals of machine learning (III) -- KNN / naive Bayes / cross validation / grid search
如何在2022年更明智地应用智能合约?
块编辑器如何选择?印象笔记 Verse、Notion、FlowUs
泰山OFFICE技术讲座:由行的布局高度,谈绘制高度的高度溢出、高度缩水(全网首发)
Reflection and imagination on the notation like tool
不愧是大佬,字节大牛耗时八个月又一力作
1亿单身男女撑起一个IPO,估值130亿
Tianyi cloud understands enterprise level data security in this way
Postman核心功能解析-参数化和测试报告
JMeter 常用的几种断言方法,你会了吗?
如何快速进阶自动化测试?听听这3位BAT大厂测试工程师的切身感想....
从零实现深度学习框架——LSTM从理论到实战【实战】
Golang through pointer for Range implements the change of the value of the element in the slice
Realizing deep learning framework from zero -- LSTM from theory to practice [practice]
[performance test] jmeter+grafana+influxdb deployment practice
Can Leica capture the high-end market offered by Huawei for Xiaomi 12s?
Go语言学习教程(十六)
国内低代码开发平台靠谱的都有哪些?
机器学习基础(三)——KNN/朴素贝叶斯/交叉验证/网格搜索
手把手教你处理 JS 逆向之图片伪装