2017年中南大学机试题(坑人oj)

题目链接链接

(帮学长研究一下机试题)

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>
#
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值