众所周知在正规比赛中是需要加freopen的。
可是
我把freopen打错啦!!!
这样是会爆零的
为了防止有人再打错freopen,于是我今天就要和大家说一说freopen怎么打
下面是样例:
freopen("文件名","r",stdin);
freopen("文件名","w",stdout);
注:运行时要加两个/
再注:提交时要去掉
就像这样:
//freopen("文件名","r",stdin);
//freopen("文件名","w",stdout);
下面是实战:
出错了 - 洛谷https://www.luogu.com.cn/problem/U502740?contestId=198067
T494125 生日判断(dirthday)
题目描述
输入身份证号判断出生日期
输入格式
字符串
输出格式
正常输出
输入输出样例
输入 #1
37152120140803391x
输出 #1
20140803
代码:
#include<bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
string a;
freopen("birthday.in","r",stdin);
freopen("birthday.out","w",stdout);
signed main(){
ios;
getline(cin,a);
for(int i=6;i<=13;i++){
cout<<a[i];
}
cout<<endl;
return 0;
}