本题要求统计给定整数M和N区间内素数的个数并对它们求和。 输入格式: 输入在一行中给出两个正整数M和N(1≤M≤N≤500)。 输出格式: 在一行中顺序输出M和N区间内素数的个数以及它们的和,数字间以空格分隔。 输入样例: 10 31 输出样例: 7 143 #include<stdio.h> #i ...
分类:
其他好文 时间:
2021-02-01 12:41:09
阅读次数:
0
STL是一个方便的工具,比如说set的互异性以及按顺序存储(红黑树);stack的先进后出;queue的先进先出;deque的兼而有之;map的匹配……但是,STL是一个很占时间复杂度的工具。所以在使用的时候最好是关闭同步防止卡时间。 ios::sync_with_stdio(false); 这样就 ...
分类:
其他好文 时间:
2021-01-30 12:12:34
阅读次数:
0
有一个3*4的矩阵,求出其中最大的那个元素的值,及其所在的行号与列号 1 #include <stdio.h> 2 int main(void) 3 { 4 int a[3][4],i,j,max,temp; 5 printf("请输入一个3*4的数组:"); 6 for(i = 0;i < 3;i ...
分类:
其他好文 时间:
2021-01-30 11:55:51
阅读次数:
0
样例输入 I am a student 样例输出 student 1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 char a[100005], b[100005]; 6 int i, num = 0; 7 while (s ...
分类:
其他好文 时间:
2021-01-29 12:05:24
阅读次数:
0
链接 : https://codeforces.com/contest/1475/problem/D 排序 + 双指针 #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.t ...
分类:
其他好文 时间:
2021-01-28 12:04:58
阅读次数:
0
1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 struct student { 6 char id; 7 struct student* next; 8 }; 9 typedef struct student S; ...
分类:
其他好文 时间:
2021-01-27 13:51:20
阅读次数:
0
如果一个字符串可以由某个长度为k的字符串重复多次得到,则称该串以k为周期,例如,abcabcabcabc以3周期 输入一个长度不超过80的字符串,输出其最小周期 #include<stdio.h> #include<string.h> //这道题使用枚举,因为它是周期字符,所以它的字符数除以一个字符 ...
分类:
其他好文 时间:
2021-01-27 13:15:21
阅读次数:
0
c语言输入字符串可以使用gets,但gets是不安全的,因为可能在不知道的情况下溢出,但使用fgets是安全的,第一个参数是字符数组的首地址,第二个参数是字符串的最大数量,第三个参数一般会填stdin,从键盘输入 #include<stdio.h> int main(void) { char c[9 ...
分类:
编程语言 时间:
2021-01-26 11:49:57
阅读次数:
0
makefile 示例 准备文件如下: fun1.c #include<stdio.h> void fun1() { printf("fun1"); } fun2.c #include<stdio.h> void fun1() { printf("fun1"); } main.c int main( ...
分类:
其他好文 时间:
2021-01-25 11:27:33
阅读次数:
0
C Hello World 实例 C 程序主要包括以下部分: 预处理器指令 函数 变量 语句 & 表达式 注释 让我们看一段简单的代码,可以输出单词 “Hello World”: #include <stdio.h>int main(){ /* 我的第一个 C 程序 */ printf("Hello ...
分类:
编程语言 时间:
2021-01-25 11:21:41
阅读次数:
0