【知识点】
● while (scanf("%d%d",&n,&m)!=EOF)功能等效于 while (~scanf("%d%d",&n,&m))
● 由下面的代码看出,EOF的值为-1。
#include <bits/stdc++.h>
using namespace std;
int main() {
printf("%d",EOF); //output -1
return 0;
}
● 函数 scanf() 的返回值是输入值的个数,如果没有输入值就是返回-1;
● 符号 ~ 表示按位取反操作,-1按位取反操作的结果是0。