百練2505:A multiplication game
阿新 • • 發佈:2017-05-18
unsigned stdio.h multi ios ica ret reg cti std
傳送門:http://bailian.openjudge.cn/practice/2505/
【題解】
我們找找規律:
1~9顯然是Stan wins.
10~18是Ollie wins.
19~162是Stan wins...
發現分界線是18^?
判判就行了。
# include <stdio.h> # include <string.h> # include <iostream> # include <algorithm> // # include <bits/stdc++.h> using namespace std; typedefView Codelong long ll; typedef long double ld; typedef unsigned long long ull; const int M = 5e5 + 10; const int mod = 1e9+7; # define RG register # define ST static double n; int main() { while (cin >> n) { while(n > 18) n /= 18; if(n <= 9) puts("Stan wins."); elseputs("Ollie wins."); } return 0; }
百練2505:A multiplication game