두 가지를 추가하는 방법은 빠른 읽기 및 쓰기

다음 코드 조각의 시작 1. 주요 기능이 추가됩니다

ios::sync_with_stdio(false);
cin.tie(0);

2. 빠른 읽기 및 쓰기가
처음 소개 <cstdio>와 <iostream> 두 라이브러리
코드의 다음 시리즈 첨가하여

using namespace std;
namespace fast_IO {
    inline int read() {
        int x=0,f=1;char ch=getchar();
        while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
        while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
        return x*f;
    }
    inline void write(int x) {a
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        if(x > 9) write(x / 10);
        putchar(x % 10 + '0');
    }
};
using namespace fast_IO;

한 번에 데이터를 읽을해야하는 경우 :

a = read();

당신은 데이터 출력이 필요한 경우 :

write(b);

때 출력에 공백이나 줄 바꿈이 필요합니다 :

putchar(' '); 
putchar('\n');

이를 바탕으로, 당신은 빨리 될 프로그램을 만들 수 있습니다

출시 세 원저 · 원 찬양 4 · 조회수 (151)

추천

출처blog.csdn.net/qq_45836635/article/details/104083847