首页 > 其他分享 >Sakurako and Kosuke

Sakurako and Kosuke

时间:2024-10-27 15:19:33浏览次数:3  
标签:will le Kosuke Sakurako 100 dot

Sakurako and Kosuke

题面翻译

题目描述

Sakurako 和 Kosuke 在数轴上用一个点玩游戏。这个点初始在数轴原点。二人轮流操作,Sakurako 先。

在第 i i i 次移动,玩家将这个点向某个方向移动 2 × i − 1 2 \times i - 1 2×i−1 个单位长度。Sakurako 向负方向移动点,而 Kosuke 向正方向。

设该点坐标为 x x x。

所以游戏开始后就会发生:

  1. Sakurako 将点沿负方向移动 1 1 1 个单位长度,此时 x = − 1 x = -1 x=−1;
  2. Kosuke 将点沿正方向移动 3 3 3 个单位长度,此时 x = 2 x = 2 x=2;
  3. Sakurako 将点沿负方向移动 5 5 5 个单位长度,此时 x = − 3 x = -3 x=−3;
  4. ⋅ ⋅ ⋅ \cdot \cdot \cdot ⋅⋅⋅

直到 ∣ x ∣ > n |x| > n ∣x∣>n 时,他们才会停下。可以证明游戏一定会结束的。

定义赢家是在游戏结束前最后一个移动点的人。

你的任务是找到赢家。

输入格式

第一行一个正整数 t t t( 1 ≤ t ≤ 100 1 \le t \le 100 1≤t≤100),表示 Sakurako 和 Kosuke 玩游戏的次数。

接下来的 t t t 行,每行一个正整数 n n n( 1 ≤ n ≤ 100 1 \le n \le 100 1≤n≤100),含义见上。

输出格式

总共 t t t 行,每行输出每次游戏的赢家。

题目描述

Sakurako and Kosuke decided to play some games with a dot on a coordinate line. The dot is currently located in position $ x=0 $ . They will be taking turns, and Sakurako will be the one to start.

On the $ i $ -th move, the current player will move the dot in some direction by $ 2\cdot i-1 $ units. Sakurako will always be moving the dot in the negative direction, whereas Kosuke will always move it in the positive direction.

In other words, the following will happen:

  1. Sakurako will change the position of the dot by $ -1 $ , $ x = -1 $ now
  2. Kosuke will change the position of the dot by $ 3 $ , $ x = 2 $ now
  3. Sakurako will change the position of the dot by $ -5 $ , $ x = -3 $ now
  4. $ \cdots $

They will keep on playing while the absolute value of the coordinate of the dot does not exceed $ n $ . More formally, the game continues while $ -n\le x\le n $ . It can be proven that the game will always end.

Your task is to determine who will be the one who makes the last turn.

输入格式

The first line contains one integer $ t $ ( $ 1\le t\le 100 $ ) — the number of games that Sakurako and Kosuke played.

Each game is described by one number $ n $ ( $ 1 \le n\le 100 $ ) — the number that defines the condition when the game ends.

输出格式

For each of the $ t $ games, output a line with the result of that game. If Sakurako makes the last turn, output “Sakurako” (without quotes); else output “Kosuke”.

样例 #1

样例输入 #1

4
1
6
3
98

样例输出 #1

Kosuke
Sakurako
Kosuke
Sakurako

code

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<cassert>
#define int long long
 
using namespace std;
 
const int N = 2e5+10,INF=0x3f3f3f3f,mod=1e9+7;
 
typedef pair<int,int> PII;

int T;
int a[N];
int b[N];

void solve(){
	int n;
	cin>>n;
	if(n&1) cout<<"Kosuke"<<endl;
	else cout<<"Sakurako"<<endl;
}
 
signed main(){
	cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

标签:will,le,Kosuke,Sakurako,100,dot
From: https://blog.csdn.net/2303_79062963/article/details/143250051

相关文章

  • Sakurako‘s Field Trip
    Sakurako’sFieldTripEveninuniversity,studentsneedtorelax.ThatiswhySakurakosteacherdecidedtogoonafieldtrip.Itisknownthatallofthestudentswillbewalkinginoneline.Thestudentwithindex......
  • cf 981 F.Kosuke's Sloth
    F.Kosuke'sSloth思路由皮亚诺定理可知,模数为\(k\)的循环节长度不会超过\(6k\),所以我们可以暴力枚举找到第一个\(k\)的倍数的位置\(p\),答案即为\(pn\),时间复杂度复杂度\(O(m)\)相关证明:PisanoPeriod-Shiina_Mashiro-博客园推论:斐波那契数列取余是否有规律?-知乎代......
  • G. Sakurako and Chefir
    G.SakurakoandChefirGivenatreewith$n$verticesrootedatvertex$1$.WhilewalkingthroughitwithhercatChefir,Sakurakogotdistracted,andChefirranaway.TohelpSakurako,Kosukerecordedhis$q$guesses.Inthe$i$-thguess,heassumesthat......
  • Codeforces Round 970 (Div. 3) D. Sakurako‘s Hobby
     链接cf_Sakurako‘sHobby大意:给一堆点和边,并给出点的颜色,输出每个点能遍历到几个黑点思路:1、这些点边里面有拓扑结构,也有环2、先处理拓扑排序的一些点,依次遍历无父节点的即可,之后就会剩下环3、有环的说明每个点都能去到环内任意一点,那么直接就记录一个sum,然后递归......
  • F. Sakurako's Box
    原题链接题意给定一个数组,随机取两个数并相乘,求该期望分析暴力方法:遍历所有数对,然后累加,最后除以数对个数\(O(n^2)\)每个数的贡献为\(\suma_j,j\in[1,n],j\nei\),遍历计算每个数对最后累加和的贡献由于要去重,所以每个数的贡献只统计前面的数的和\(O(n)\)code#include......
  • D. Sakurako's Hobby
    原题链接题意每个数要么黑色,要么白色,每个数都有跳往下一个数,请问你最多能得到几个黑色数?分析前往下一个数具有很强的指示性,所以我们可以画一个有向图出来那么问题就变成了一个有向图,问图中的每个点最多能到达几个黑色的点?(只有一个出边)但是注意本题,由于是排列,每个点最多只有......
  • G. Sakurako's Task
    https://codeforces.com/contest/2008/problem/G总结:一开始思路错了,考虑的只有n=1和g=1,还有其他情况。其实情况应该分为其他三种:n=1,n个数之间的所有空缺都能被填完(并且k仍剩余可以继续往后填),n个数之间的空缺不能被填完三种情况。inlinevoidsolve(){ intn,k; cin>>......
  • H. Sakurako's Test
    H.Sakurako'sTestSakurakowillsoontakeatest.Thetestcanbedescribedasanarrayofintegers$n$andataskonit:Givenaninteger$x$,Sakurakocanperformthefollowingoperationanynumberoftimes:Chooseaninteger$i$($1\lei\len$......