2017Nowcoder Girl初賽重現賽 B 勇氣獲得機
阿新 • • 發佈:2018-12-15
#include<stdio.h> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include<string.h> #include<queue> #include<stack> #include<list> #include<map> #include<set> #include<vector> using namespace std; typedef long long int ll; const int maxn =1e5+5; const int maxm=10000; const int mod =1e9+7; const int INF=0x3f3f3f3f; const double eps=1e-8; int main() { int n;scanf("%d",&n); stack<char>s; while(n) { if(n&1) { s.push('N'); n=(n-1)/2; } else { s.push('G'); n=(n-2)/2; } } while(!s.empty()) { printf("%c",s.top()); s.pop(); } return 0; }