NOIP输出格式
  • 板块灌水区
  • 楼主Daidly
  • 当前回复12
  • 已保存回复12
  • 发布时间2021/11/12 21:20
  • 上次更新2023/11/4 00:46:28
查看原帖
NOIP输出格式
271736
Daidly楼主2021/11/12 21:20
#include<bits/stdc++.h>
using namespace std;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

inline void print(int x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10);
	putchar(x%10^48);
}

int n;

int main(){
	freopen("1.in","r","stdin");
	freopen("1.out","w","stdout");
	n=read();
	print(n),puts("");
	return 0;
}

本人喜欢用上面那种的输入输出,可否在 NOIP 中使用,主要是想问 print()+puts("") 的,因为考场上的代码似乎要清空什么什么的 fclose 之类的

2021/11/12 21:20
加载中...