目录
一.超全的高难度ACM/OI模板
(1)cin同步输入,一个cin语句中,无法互相调用,cin结束以后才真正赋值
#include<iostream>
using namespace std;
int x,y,d,n,maxm,num,sum=1,f[100],a;
int main()
{
ios::sync_with_stdio(false);
cin>>a>>f[a];
cout<<a<<endl<<f[a]<<endl;
}
注意!输出结果为:
10
0
(2)不开long long 见祖宗!!
速查表:
char -128 ~ +127 (1 Byte)
short -32767 ~ + 32768 (2 Bytes)
unsigned short 0 ~ 65536 (2 Bytes)
int -2147483648 ~ +2147483647 (4 Bytes)
unsigned int 0 ~ 4294967295 (4 Bytes)
long == int
long long -9223372036854775808 ~ +9223372036854775807 (8 Bytes)
double 1.7 * 10^308 (8 Bytes)
(3)getline,cin,(cin>>x).get();
#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cmath>
#define debug cout<<"ok"<<endl
typedef long long ll;
const int maxn=1e4+500;
const int mod=1e9+7;
using namespace std;
string s,buf;
int n;
int main()
{
ios::sync_with_stdio(false);
(cin>>n).get();//cin>>n会忽略掉换行符而getline遇见换行符会停止所以cin不能配getline要用(cin>>n).get();代替
getline(cin,s);
stringstream ss(s);
while(ss>>buf)
{
cout<<buf<<endl;
}
}
[矩阵求斐波那契数列]
结构体重载比较运算符来排序
struct person
{
ll yu,shu,ying,sum,idx;
bool operator<(const person &t)const
{
if(t.sum!=sum)return sum>t.sum;
if(t.yu!=yu)return yu>t.yu;
return idx<t.idx;
}
}p[N];
。。。。。。。。。
sort(p+1,p+1+n);//直接sort就行了
(4)不要滥用return,不要随意建函数用return,我就是因为用return,导致还有数据要输入结果WA了QwQ
!!!!!!!!!!!!!!!待解决
1.幂次方
2.CF1295C Obtain The String
3.