After Training CodeForces - 195B

B - After Training CodeForces - 195B

解题思路 模拟

球放 有球最少的篮子 并在此基础上尽量靠中间
取模判定 位置 注意左右 奇数 偶数

AC 代码如下

#include<iostream>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i = 0; i<n; i++) 
    printf("%d\n",(m+i%m)%2 ? ((m+i%m+1)/2) : (m-(i%m))/2);
    return 0 ;
}

猜你喜欢

转载自www.cnblogs.com/maxv/p/11704843.html
今日推荐