1. 程式人生 > >百練2505:A multiplication game

百練2505:A multiplication game

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;

typedef 
long 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."); else
puts("Ollie wins."); } return 0; }
View Code

百練2505:A multiplication game