题目链接链接
(帮学长研究一下机试题)
A 木棍,注意不能是正方形;
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
using namespace std;
const int maxn = 1e5+50;
const int inf = 0x3f3f3f3f;
int n;
int main()
{
while(~scanf("%d",&n))
{
long long ans = 0;
if(n%2!=0)
{
printf("0\n");
}
else
{
if(n%4==0)
printf("%d\n",n/4-1);
else
printf("%d\n",n/4);
}
}
// cout << "Hello world!" << endl;
return 0;
}
B题
wa了n次,这个中南大学的oj太傻逼了!!! 输入输出很有问题,做了这么多年oj,第一次发现scanf没有返回值会导致错误的。
无力吐槽了,代码从一开始就是对的!我服了。
第一次一道简单模拟题我做了一个半小时,我都开始怀疑人生了。
幸好我没放弃,帮学长踩出坑来了,注意输入输出。而且后来用getchar()的时候也会出现诡异的错误。
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#