摘要:#include <math.h> double ceil( double num ); double floor( double arg ); ceil函数返回不小于num的最小整数,如num = 6.04, 则返回7.0 floor函数返回不大于num的最大的数,如num = 6.04, 则返回
阅读全文
摘要:int read() { int a=0,x=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')x=-1;ch=getchar();} while(ch>='0'&&ch<='9'){a=a*10+ch-'0';ch=getchar();}
阅读全文
摘要:树状数组单点修改区间查询 #include<iostream> using namespace std; int n,m; int tree[2000020]; int lowbit(int x) { return x&(-x); } void update(int x,int v) { while
阅读全文
摘要:#include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; typedef long long ll; const int maxn = 1000000; const i
阅读全文
摘要:#include<iostream> #include<cstring> using namespace std; int main() { int t; cin>>t; string a,b; while(t--) { cin>>a>>b; if(a+b>b+a) { cout<<">"<<end
阅读全文
摘要:#include<iostream> #include<cstring> using namespace std; struct node { int v; int next; }edge[1010]; int dfn[1010],low[1010],heads[1010]; int cnt,vis
阅读全文
摘要:#include<iostream> using namespace std; int n,m,k,ans; int map[110][110]; int vis[110][110][110]; int main() { cin>>n>>m>>k; for(int i=1;i<=n;i++) { f
阅读全文
摘要:#include <iostream> using namespace std; int a,c; char b; int ans; int main() { cin>>a>>b>>c; if(a>12||a==0) { ans++; } if(a>12||a==0) { if(c>31) { an
阅读全文
摘要:#include <iostream> #include<cstring> using namespace std; int dp[1000050]; int main() { memset(dp,0x3f3f,sizeof dp); dp[1] = 1; int n; cin>>n; while(
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; bool cmp(int x,int y) { return x>y; } int ans=2147483647,n,k; int t[1010],s[1010]; void df
阅读全文
摘要:#include<iostream> using namespace std; int a[50010],dp[50050]; int ans=-2147483647; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; dp
阅读全文
摘要:#include<iostream> using namespace std; int n,sum=0; int ans[15]; bool judge() { int cnt=0; for(int i=3; i<=n; i++) { if(ans[i]==ans[i-2]) { cnt++; }
阅读全文
摘要:这题好像就是个01背包啊。。。 #include<iostream> using namespace std; int w; int dp[60]; int main() { int n,c; cin>>n>>c; int sum=0; for(int i=1;i<=n;i++) { cin>>w;
阅读全文
摘要:#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; void change(int n,int r) { if(n==0) { return; } int m=n%r;
阅读全文
摘要:#include<iostream> using namespace std; int a[100],n,m; void dfs(int dep,int pre,int sum) { if(sum==n) { for(int i=1; i<=dep-1; i++) { cout<<a[i]; if(
阅读全文
摘要:50分代码(无能为力) 优先队列 #include<iostream> #include<queue> #define val first #define high second using namespace std; const int M = 1000000; int n,m; priorit
阅读全文
摘要:#include<iostream> #include<algorithm> #include<cmath> using namespace std; struct node { double l; double r; }a[1010]; bool cmp(node x,node y) { retu
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; struct node { int tl; int km; }a[510]; bool cmp(node x,node y) { return x.km>y.km; } int t
阅读全文
摘要:#include<iostream> #include <algorithm> using namespace std; struct node { int w; int f; int s; }p[50010]; bool cmp(node x,node y) { return x.s < y.s;
阅读全文
摘要:#include <iostream> using namespace std; struct node { int cost; int need; }p[10010]; int main() { int n,s; cin>>n>>s; for (int i=1;i<=n;i++) { cin>>p
阅读全文
摘要:#include <iostream> #include <algorithm> using namespace std; struct node { int l; int r; int w; }p[1010]; bool cmp(node x,node y) { return x.w < y.w;
阅读全文
摘要:#include <iostream> #include <cstring> using namespace std; char a[260]; int main() { int len,k; cin>>a; cin>>k; len=strlen(a); while(k--) { for(int i
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; int a[210]; int wst[210]; bool cmp(int a,int b) { return a>b; } int main() { int m,s,c; ci
阅读全文
摘要:#include<iostream> using namespace std; const int max_M = 5000005; const int max_N = 500005; int n, m, X[max_M],Y[max_M], P[max_N], preX[max_M], preY[
阅读全文
摘要:#include<iostream> using namespace std; int main() { int n; cin>>n; if(n<=6) { cout<<(n+1)/2<<endl; for(int i=1;i<=n;i++) { cout<<(1+i)/2<<" "; } } el
阅读全文
摘要:#include<iostream> using namespace std; #define N 90000 #define ll long long #define inf 1000000000 ll s[N],t[N]; int n,k; bool check(ll x) { int tp =
阅读全文
摘要:#include<iostream> #include<iomanip> using namespace std; int main() { int n; cin>>n; int x,y; double sum=0; for(int i=1;i<=n;i++) { cin>>x>>y; sum=su
阅读全文
摘要:#include<iostream> #include<cstring> using namespace std; int a[101][101],n,flag,num; int b[101],d[101]; void print() { flag=1; for(int i=1;i<=n;i++)
阅读全文
摘要:#include<iostream> using namespace std; int a[1010]; int x,y; int temp; int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { a[i]=i; } for(int i=1
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; bool cmp(int a,int b) { return a>b; } int w[10010]; int main() { int n,k; cin>>n>>k; for(i
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; struct node { int l; int r; }a[10010]; bool cmp(node x,node y) { if(x.l==y.l) { return x.r
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; struct food { int a; int b; }f[210]; bool cmp(food x,food y) { return x.a>y.a; } int kind[
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; struct node { int l,w; }a[1010]; int t[1010]; bool cmp(node x,node y) { if(x.l==y.l) retur
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; int b[1010],e[1010]; int t,temp; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>
阅读全文
摘要://思路:用最少的美元换最多的马克,再用最少的马克换最多的美元 即:寻找当第i天的数大于第i+1天时,就将美元换成马克再换回美元(sum=sum*a[i]/a[i+1]) #include<iostream> #include<iomanip> using namespace std; int a[
阅读全文
摘要://这题好像不贪心啊+_+ #include<iostream> using namespace std; int a; int main() { int n,m; cin>>n>>m; int ans=0; int sum=0; for(int i=1;i<=n;i++) { cin>>a; if
阅读全文
摘要:1.需要头文件 #include <iomanip> 2. 要保留两位有效小数 cout<<setiosflags(ios::fixed)<<setprecision(2)<< 然后再输出实数类型变量即可以保留2位小数输出了,当然你要保留三位小数,setprecision(3)就行。 setprec
阅读全文
摘要:#include<iostream> using namespace std; #define N 205 int n,m; int a[N]; int f[N][N]; inline void updata(int k) { for(int i=0;i<n;i++) { for(int j=0;j
阅读全文
摘要:#include<cstdio> #include<cstring> #include<algorithm> #include<cassert> #include<queue> #include<vector> #include<map> #include<cmath> #include<set>
阅读全文
摘要:#include<iostream> using namespace std; int main() { int t,N;//t为几组,N为几堆 cin>>t; while(t--) { int win=0; //更新 cin>>N; int n,m;//m为每堆数量,n为每堆可取的最大数量 whi
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int MAXN=300010; int n,m,a[MAXN],b[MAXN],p[MAXN],v[MAXN]; int
阅读全文
摘要://我的80分代码=_=(de不出来)(好像是"ERROR”的问题) #include<iostream>#include <cstring>#include<algorithm>#include <cstdio>using namespace std;char tmp[1000];char str
阅读全文