如果读入是正数,没有问题。
如果读入了负数,好像一定会错。
太坑了,考试的时候要么用读入优化,要么用cin,scanf太玄学了。。
如图:
1 #include<bitsstdc++.h> 2 using namespace std; 3 4 int main(){ 5 while(1){ 6 long long x; 7 scanf("%d",&x); 8 cout << x << endl; 9 } 10 return 0; 11 }