最近打模拟赛,一个毒瘤数据卡快读,用下面这个程序尝试把ch==-1的数量输出一下,发现输都输不完,输出的tot都到几十亿了还是没有结束,只能用cin了吗?
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
using namespace std;
const int C=1000000007;
const int N=500100;
int m,n,a[N],tot;
char Getchar()
{
char ch=getchar();
if(ch==-1)
{
tot++;
if(tot%1000000==0) cout<<tot<<endl;//
}
return ch;
}
long long read()
{
long long f = 1, x = 0;
char ch = Getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-') f = -1;
ch = Getchar();
}
while (ch >= '0' && ch <= '9')
{
x = x * 10 + ch - '0';
ch = Getchar();
}
x *= f;
return x;
}
int main()
{
freopen("btsc6.in","r",stdin);
m=read();
n=read();
for(int i=1;i<=m;i++)
{
a[i]=read();
}
cout<<tot<<endl;
return 0;
}