摘要: 一.埃氏筛: 埃氏筛就是利用每个数的合数一定不是素数,用空间换取时间,筛选出一定范围内的素数。(合数:就是某个数的倍数*2,*3......这种) 代码实现: 1 #include <stdio.h> 2 #include <stdlib.h> 3 int a[1000000]; 4 int mai 阅读全文
posted @ 2022-01-12 17:27 scannerkk 阅读(21) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 int main() 3 { 4 int n; 5 int i=1,j; 6 int flag=0; 7 long long int m=1,b; 8 int a[31][10]={0}; 9 int c[10]={0}; 10 a[0][1]=1; 1 阅读全文
posted @ 2022-01-12 17:14 scannerkk 阅读(28) 评论(0) 推荐(0)
摘要: 1 #include "stdio.h" 2 int main() 3 { 4 int target = 7; 5 int nums[6] = {2,3,1,2,4,3}; 6 int numsSize = 6; 7 int point1,point2; 8 long long int sum = 阅读全文
posted @ 2022-01-12 17:13 scannerkk 阅读(233) 评论(0) 推荐(0)
摘要: 证明(m * n) % c = (m % c * n % c) % c 设m = ic + p 设n = jc + q 左式等于((ic + p) * (jc + q)) % c 化简得(ijc^2 + iqc + jpc + pq)% c = pq % c 右式等于((ic + p) % c * 阅读全文
posted @ 2022-01-12 16:52 scannerkk 阅读(51) 评论(0) 推荐(0)
摘要: 一.题目描述: 二.解题思路: 简单快速幂和取余运算 三.代码实现: 1 #include "bits/stdc++.h" 2 using namespace std; 3 int main() 4 { 5 long long int a,b,p; 6 long long int ans = 1; 阅读全文
posted @ 2022-01-12 16:48 scannerkk 阅读(33) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 struct stack{ 3 int top; 4 int data[100]; 5 }; 6 struct queue{ 7 int head; 8 int tail; 9 int paper[1000]; 10 }; 11 int book[10] 阅读全文
posted @ 2022-01-12 16:44 scannerkk 阅读(113) 评论(0) 推荐(0)
摘要: 1 #include "stdio.h" 2 #include "stdlib.h" 3 #include "string.h" 4 typedef struct Candidates{//创建候选人结构 5 char name[20];//投票人姓名 6 int vote;//投票数 7 stru 阅读全文
posted @ 2022-01-12 16:42 scannerkk 阅读(40) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> typedef struct Node { int val; struct Node *next; }Node,*PNode; typedef struct Stack { struct Node *top; struct 阅读全文
posted @ 2022-01-12 16:40 scannerkk 阅读(29) 评论(0) 推荐(0)
摘要: 1 #include "stdio.h" 2 #include "string.h" 3 int que[100];//定义队列 4 char Ask[100];//定义询问串 5 void pop(int *front,int *top) 6 { 7 if(*front == *top){ 8 p 阅读全文
posted @ 2022-01-12 16:32 scannerkk 阅读(45) 评论(0) 推荐(0)
摘要: 一.前言: 逆波兰表示法 ( Reverse Polish notation , RPN ,或 逆波兰记法 ),是一种是由 波兰 数学家 扬·武卡谢维奇 1920年引入的数学表达式形式,在逆波兰记法中,所有 操作符 置于 操作数 的后面,因此也被称为 后缀表示法 (也称后缀表达式)。而我们平常用的a 阅读全文
posted @ 2022-01-12 12:29 scannerkk 阅读(785) 评论(0) 推荐(0)