08 / hdu6127 枚举
#includeusing namespace std;#pragma comment(linker, "/STACK:102400000,102400000")#define rep(i,a,b) for (int i=a; i<=b; ++i)#define per(i,b,a) for (int i=b; i>=a; --i)#define mes(a,b) memset(a,b,sizeof(a))#define INF 0x3f3f3f3f#define MP make_pair#define PB push_back#define fi first#define se secondtypedef long long ll;const int N = 50005;struct P { double rat, x, y; ll val; friend bool operator < (P a, P b) { return a.rat
11 / hdu6130 打表
#includeusing namespace std;#pragma comment(linker, "/STACK:102400000,102400000")#define rep(i,a,b) for (int i=a; i<=b; ++i)#define per(i,b,a) for (int i=b; i>=a; --i)#define mes(a,b) memset(a,b,sizeof(a))#define INF 0x3f3f3f3f#define MP make_pair#define PB push_back#define fi first#define se secondtypedef long long ll;const int N = 10000005;int n, a[N];void Init(){ int len=1, pre=1, now; a[1]=1, a[2]=2; rep(ca,2,N-1) { if(len>=10000000) break; now = 1+(pre==1); rep(i,1,a[ca]) a[++len]=now; pre=now; }}int main(){ Init(); int T; scanf("%d", &T); while(T--) { scanf("%d", &n); printf("%d\n", a[n]); } return 0;}