快读(double)

· · 个人记录

#include<bits/stdc++.h>
using namespace std;

#define cin IO::fin
#define cout IO::fout
namespace IO{
const int Msize=1<<18;
char ibuf[Msize],*is=ibuf,*it=ibuf;
char tmp[Msize];unsigned int cnt=0;
inline char getch(){
    if(__builtin_expect(is==it,0)){
        it=(is=ibuf)+fread(ibuf,1,Msize,stdin);
    }
    return is==it?EOF:*is++;
}
inline void flush(){
    fwrite(tmp,1,cnt,stdout);
    cnt=0;
}
inline void putch(char c){
    tmp[cnt++]=c;
    if(__builtin_expect(cnt==Msize,0)){
        flush();
    }
}
struct IO_bool{
    inline bool readBool(){
        char c=getch();
        while(!isdigit(c)){
            c=getch();
        }
        return c=='1';
    }
    inline void putBool(bool x){
        putch(x?'1':'0');
    }
}Bool;
struct IO_char{
    inline char readChar(){
        int c=getch();
        while(c==' '||c=='\n'||c=='\r'){
            c=getch();
        }
        return c;
    }
    inline void putChar(char c){
        putch(c);
    }
}Char;
struct IO_string{
    inline std::string readString(){
        std::string s="";
        int c=getch();
        while(c==' '||c=='\n'||c=='\r'){
            c=getch();
        }
        while(c!=' '&&c!='\n'&&c!='\r'){
            s+=c,c=getch();
        }
        return s;
    }
    inline void putString(std::string s){
        for(int i=0;i<s.size();i++){
            putch(s[i]);
        }
    }
}String;
struct IO_i32{
    int readI32(){
        int x=0,c=getch();bool y=0;
        for(;__builtin_expect(!isdigit(c),0);c=getch()){
            y|=c=='-';
        }
        for(;__builtin_expect(isdigit(c),1);c=getch()){
            x=(x<<3)+(x<<1)+(c^48);
        }
        return y?-x:x;
    }
    inline void putI32(int x){
        int sout[10],top=0;
        if(__builtin_expect(x<0,0)) putch('-'),x=-x;
        if(__builtin_expect(x==0,0)) putch('0');
        for(;__builtin_expect(x,1);x/=10){
            sout[++top]=(x-x/10*10+48);
        }
        while(top){
            putch(sout[top--]);
        }
    }
}I32;
struct IO_i64{
    long long readI64(){
        long long x=0;
        int c=getch();bool y=0;
        for(;__builtin_expect(!isdigit(c),0);c=getch()){
            y|=c=='-';
        }
        for(;__builtin_expect(isdigit(c),1);c=getch()){
            x=(x<<3)+(x<<1)+(c^48);
        }
        return y?-x:x;
    }
    inline void putI64(long long x){
        int sout[10],top=0;
        if(__builtin_expect(x<0,0)) putch('-'),x=-x;
        if(__builtin_expect(x==0,0)) putch('0');
        for(;__builtin_expect(x,1);x/=10){
            sout[++top]=(x-x/10*10+48);
        }
        while(top){
            putch(sout[top--]);
        }
    }
}I64;
struct IO_i128{
    __int128 readI128(){
        __int128 x=0;
        int c=getch();bool y=0;
        for(;__builtin_expect(!isdigit(c),0);c=getch()){
            y|=c=='-';
        }
        for(;__builtin_expect(isdigit(c),1);c=getch()){
            x=(x<<3)+(x<<1)+(c^48);
        }
        return y?-x:x;
    }
    inline void putI128(__int128 x){
        int sout[15],top=0;
        if(__builtin_expect(x<0,0)) putch('-'),x=-x;
        if(__builtin_expect(x==0,0)) putch('0');
        for(;__builtin_expect(x,0);x=((x*429496730)>>32)){
            sout[++top]=(x-((x*429496730)>>32)*10+48);
        }
        while(top){
            putch(sout[top--]);
        }
    }
}I128;
struct IO_double{
    inline double readDouble(){
        long long x0=0;
        double x1=0,x2=0;
        bool y=0;
        int wei=0,c=getch();
        while(!isdigit(c)){
            y|=c=='-',c=getch();
        }
        while(isdigit(c)){
            x0=(x0<<3)+(x0<<1)+(c^48),c=getch();
        }
        x1+=1.0*x0;
        if(c!='.'){
            return y?-1.0*x1:x1;
        }
        c=getch();
        while(isdigit(c)){
            x2=x2*10.0+1.0*(c-48),c=getch();
            wei++;
        }
        x1+=x2/pow(10.0,wei);
        return y?-1.0*x1:x1;
    }
    inline void putDouble(std::pair<double,int> x){
        if(x.first<0){
            putch('-'),x.first=-x.first;
        }
        long long x_In=x.first,P=pow(10,x.second),x_out,tot=0;
        x.first=1.0*(x.first-1.0*x_In)*1.0*P;
        long long x_D=x.first;
        x.first-=1.0*x_D;
        x_D+=1.0*(x.first>=0.5);
        x_In+=(P==x_D);
        x_D*=(P!=x_D);
        int sout[20];
        I64.putI64(x_In);
        if(__builtin_expect(!x.second,0)){
            return;
        }
        putch('.');
        x_out=x_D;
        for(;__builtin_expect(x_D,1);x_D/=10){
            sout[++tot]=(x_D-x_D/10*10+48);
        }
        x.second-=tot;
        while(x.second--){
            putch('0');
        }
        if(x_out){
            while(tot){
                putch(sout[tot--]);
            }
        }
    }
}Double;
struct Basic{
    Basic &operator>>(bool &A){A=Bool.readBool();return (*this);}
    Basic &operator>>(char &A){A=Char.readChar();return (*this);}
    Basic &operator<<(const char &A){putch(A);return (*this);}
    Basic &operator>>(string& A){A=String.readString();return (*this);}
    Basic &operator<<(const string& A){String.putString(A);return (*this);}
    Basic &operator>>(int &A){A=I32.readI32();return (*this);}
    Basic &operator<<(const int &A){I32.putI32(A);return (*this);}
    Basic &operator>>(long long &A){A=I64.readI64();return (*this);}
    Basic &operator<<(const long long &A){I64.putI64(A);return (*this);}
    Basic &operator>>(__int128 &A){A=I128.readI128();return (*this);}
    Basic &operator<<(const __int128 &A){I128.putI128(A);return (*this);}
    Basic &operator>>(double &A){A=Double.readDouble();return (*this);}
    Basic &operator<<(const std::pair<double,int> &A){Double.putDouble(A);return (*this);}
    ~Basic(){flush();}
}fin,fout;
}
double a;
int main(){
    freopen("fast_o.out","w",stdout);
    for(double i=0;i<=1e7;i++){
    cout<<pair<double,int>(i+1e-14*i,12)<<'\n';
    }
}