3 条题解
- 1
信息
- ID
- 876
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 1
- 标签
- 递交数
- 107
- 已通过
- 79
- 上传者
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if (n%2==0)
cout<<n/2+n/2+1;//貌似可以直接n+1诶()
else
cout<<n/2+1;
return 0;
}
是可以写成n+1 ,n的一半+n的一半=n O(∩_∩)O
#include <iostream>//hetao3097453
using namespace std;
int main()
{
int n;
cin >> n;
if(n % 2 == 0)
{
cout << n + 1;
}
else
{
cout << n / 2 + 1;
}
return 0;
}
奇数 / 2 + 1
偶数 + 1