Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

尽量精简了

Posted by pipipapasha at 2023-10-31 00:10:02 on Problem 1019
#include <iostream>
#include <vector>
using namespace std;
unsigned int n,x,p,i,t,F[31269]={0,1};
char m[9];
vector<char> a(1,'1');
int main()
{
    for(i=2;i<31269;i++){
        t=0;
        x=i;
        while(1){
            m[t++]=x%10+'0';
            if(!(x/=10))break;
        }
        F[i]=F[i-1]*2-F[i-2]+t;
        while(t--)a.push_back(m[t]);
    }
    cin>>n;
    while(n--){
        cin>>x;
        for(i=1;i<31269;i++)if(x<=F[i])break;
        p=x-F[i-1];
        cout<<a[p-1]<<endl;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator