#include<iostream>
#include<cstdio> using namespace std; unsigned long long n; int main(){ cin>>n; for(unsigned long long x=9223372036854775808,a=64;a!=-1;x/=2,a-=1){ if(n/x!=0&&a!=1){ cout<<"2^"<<a-1<<"+"; } if(a==1){ cout<<"2^0"; } } return 0; }
题目 438 烦人的幻灯片
2018-12-03 20:20:04
|
|
#include <cstdio>
#include <algorithm> #include <cstring> typedef long long L; using namespace std; L a, b, c, _10[15], ans[15], f[15][15][15]; bool flag; void get_f(){ _10[0] = 1; for(int i = 1; i < 15; i++) _10[i] = _10[i-1]*10; for(int i = 1; i < 10; i++) f[i][1][i] = 1; for(int i = 1; i < 10; i++) for(int j = 2; j < 15; j++){ f[i][j][1] = _10[j-2]*(j-1); for(int k = 2; k < 10; k++) f[i][j][k] = f[i][j][1]; } for(int i = 1; i < 10; i++) for(int j = 2; j < 15; j++){ f[i][j][i] += _10[j-1]; } } void get_all(){ int la = 0, lb = 0; L ta = a-1, tb = b, all = 0; while(ta){ la++, ta /= 10; } while(tb){ lb++, tb /= 10; } for(int i = la; i < lb; i++){ all += (_10[i]-_10[i-1])*i; } all += (b-_10[lb-1]+1)*lb; all -= (a-_10[la-1])*la; ans[0] = all; } L d(L k, int i){ if(!k) return 0; int fir, len = 0; L t = k, res = 0; while(t){ len++, t /= 10; } fir = k / _10[len-1]; if(len == 1) return i <= k; for(int j = 1; j < fir; j++){ res += f[j][len][i]; } res += d(k%_10[len-1], i) + d(_10[len-1]-1, i) + (fir==i)*(k%_10[len-1]+1); return res; } int main() { freopen("count2013.in", "r", stdin); freopen("count2013.out", "w", stdout); scanf("%lld %lld", &b, &c); a = 1; get_f(); get_all(); for(int i = 1; i < 10; i++){ ans[i] = d(b, i) - d(a-1, i); ans[0] -= ans[i]; } printf("%lld ", ans[c]); return 0; }
题目 438 烦人的幻灯片
2018-12-03 19:03:14
|
|
#include <iostream>
#include<cstdio> using namespace std; int main() { //freopen("mas.in","r",stdin); //freopen("mas.out","w",stdout); int a[100][100]; int i,j,n; int max,point,flag=1,work=1; cin>>n; for(i=0;i<n;i++) for(j=0;j<n;j++) cin>>a[i][j]; for(i=0;i<n;i++) { max=a[i][0]; point=0; for(j=1;j<n;j++) { if(max>a[i][j]) { max=a[i][j]; point=j; } } flag=1; for(j=0;j<n;j++) { if(a[j][point]>max) flag=0; } if(flag) { cout<<i+1<<" "<<point+1<<" "<<max<<endl; return 0; } } cout<<"no"<<endl; return 0; }
题目 438 烦人的幻灯片
2018-11-28 19:30:10
|
|
回复 @天下第一的吃殿下 :
#include<iostream> #include<cstdio> using namespace std; int main() { freopen("snake.in","r",stdin); freopen("snake.out","w",stdout); int a[102][102],d=1; int n; cin>>n; for(int i=1,x=1,y=1;i<=n*n;i++) { a[x][y]=i; if(d==1){ x=x+1; if(y==1) d=2; else d=4; } else if(d==2) { x=x-1;y=y+1; if(y==n)d=1; else if(x==1) d=3; } else if(d==3) { y=y+1; if(x==n) d=2; else d=4; } else if(d==4) { x=x+1;y=y-1; if(x==n) d=3; else if(y==1) d=1; } } for(int i=1;i<=n;i++) { for(int k=1;k<=n;k++) { cout<<a[i][k]<<" "; } cout<<endl; } return 0;}
题目 438 烦人的幻灯片
2018-11-28 18:39:17
|
|
其实和"稳定婚姻"差不多,不过这题没有给出一个最大匹配,但只是问整个图中是否存在交错环.
题目 438 烦人的幻灯片
2016-08-11 20:16:40
|
|
None.............
|
|
|
|
过了两个点之后发现样例过不去了……
|
|
写了这么麻烦的代码居然一共只有3个点????!!!!!
题目 438 烦人的幻灯片
2012-10-04 18:02:22
|