cf 55A(暴力 )

        

                  鏈接:http://codeforces.com/problemset/problem/55/A

      直接暴力 ..

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=100005;
map<int,int>m;
int main()
{
    int n;
    scanf("%d",&n);
    ll res=0;
    for(int i=1;i<maxn;i++)
    {
        res+=i;
        m[res%n+1]++;
    }
    if(m.size()==n)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章