#include<iostream> #include<fstream> using namespace std; //总体思想就是流,和标准输入输出cin/cout很类似 //只是这个流是在文件中发生而不是显示器上 class Person { public: //放个空的构造函数方便创建空对象 ...
分类:
编程语言 时间:
2020-11-20 11:48:51
阅读次数:
6
A 输入,第i个人把礼物给了谁,输出,第i个人的礼物是谁给的 #include<bits/stdc++.h> using namespace std; typedef long long ll; #define ture true int main() { int n,flag=0,a[200],b ...
分类:
其他好文 时间:
2020-11-20 11:48:21
阅读次数:
6
放个代码吧,开个坑 #include<bits/stdc++.h> #define rep(i,a,b) for (register int i=(a);i<=(b);i++) #define drep(i,a,b) for (register int i=(a);i>=(b);i--) typed ...
分类:
其他好文 时间:
2020-11-20 11:48:09
阅读次数:
5
题目链接:a^b 题目分析: 简单数论,快速幂模板题 代码如下: #include<bits/stdc++.h> using namespace std; #define mm(a,x) memset(a,x,sizeof a) #define mk make_pair #define ll lon ...
分类:
编程语言 时间:
2020-11-19 13:00:22
阅读次数:
21
1 #include <iostream> 2 #include <cstdio> 3 #include <memory.h> 4 using namespace std; 5 const int INF=0x3f3f3f3f,city=4; 6 int main(){ 7 int a[city][ ...
分类:
其他好文 时间:
2020-11-19 12:53:22
阅读次数:
10
1.算法思想 选择排序,从头至尾扫描序列,找出无序区最小的一个元素,和有序区的最后一个元素比较,如果较小就交换元素,如果相等就不交换元素,接着下一次循环(有序区不断增加,无序区不断往后减少),执行同样的操作,最终得到一个有序序列。 2.C++实现 #include <iostream> using ...
分类:
编程语言 时间:
2020-11-19 12:46:29
阅读次数:
11
Eratosthenes筛法,快速求素数。 时间复杂度 O(nlogn)。 思想 对于每个不超过n的非负整数p,删除2p,3p,4p,......,当处理完所有数后,还没有被删除的就是素数。 代码 #include <iostream> using namespace std; /** * Erat ...
分类:
其他好文 时间:
2020-11-19 12:19:29
阅读次数:
5
#include <cstdio> #include <cstring> #include <iostream> #include <stdio.h> using namespace std; bool CheckYear(int n) { if(n % 400 == 0) return true; ...
分类:
其他好文 时间:
2020-11-18 13:24:48
阅读次数:
28
list: 底层实现为双向链表 1、基本用法 #include <iostream> #include <list> using namespace std; // list:双向链表 void ShowPrint(list<int> d) { for (list<int>::iterator it ...
分类:
其他好文 时间:
2020-11-17 13:02:23
阅读次数:
27
1 #include<bits/stdc++.h> 2 #define ll long long 3 #define INF 1e17 4 using namespace std; 5 const int N = 2e5 + 10; 6 ll n, k; 7 ll a[N]; 8 9 bool ch ...
分类:
其他好文 时间:
2020-11-17 12:50:15
阅读次数:
11