当前位置:网站首页>2019 Hangzhou Electric Multi School Game 9 6684 Rikka with game [game question]
2019 Hangzhou Electric Multi School Game 9 6684 Rikka with game [game question]
2022-07-24 19:34:00 【Cold instant noodles】
2019 Hangzhou Electric Power Co., Ltd Scene nine 6684-Rikka with Game【 Game problem 】
General meaning :
Give a string ,R First of all ,R I want to change the dictionary order of strings to smaller ,Y I want to change the dictionary order of strings , Everyone takes turns to revise , Every time everyone has two choices , One is to change the letter of a certain digit back to a digit , such as a->b, d->e, The second is to end the game . Ask what the modified string looks like .
Ideas :
A game problem .
If the first is a~x The letter of , If you modify it first , Then the backhand ends the game directly . If you don't modify it first , Then the backhand goes directly to add the first , Then, no matter who changes it first , The backhand will end the game directly in the next round .
If the first is y, If you modify it first, it will become z , Then the backhand will end the game directly . If you don't modify it first , If later revised , That first hand will continue to be revised into a, Then it will be modified to b, At this point, the first hand will choose to end the game . So no matter who will not modify y Of .
If the first is z , First hand will definitely be modified to a, Later modified as b, Then finish the game first .
So the conclusion is , Find the first string that is not y The characters of , If it is z It is modified to b And end the game , Otherwise, end the game directly .
Code :
#include<cstdio>
#include<iostream>
#include<string.h>
using namespace std;
int main() {
int t;
char ss[1000];
scanf("%d",&t);
while(t--) {
scanf("%s",ss);
int lenss = strlen(ss);
for(int i = 0; i < lenss; i++) {
if(ss[i] != 'y') {
if(ss[i] == 'z') {
ss[i] = 'b';
break;
}
else
break;
}
}
puts(ss);
}
return 0;
}
边栏推荐
- Techempower web framework performance test 21st round results release --asp Net core continue to move forward
- Channel state information (CSI) conjugate multiplication denoising method
- Hold the C pointer
- Nezha monitoring - server status monitoring, SSL certificate change expiration, Ping monitoring and scheduled task reminder
- Solutions to oom caused by pictures in res directory
- Machine learning_ Softmax function (multi classification problem)
- Virbox compiler, which supports source code encryption of the whole platform and architecture
- Day 4 (item 1: household income and expenditure records)
- Hidden Markov model HMM
- Tencent Browser service TBS usage
猜你喜欢

Meshlab&PCL ISS关键点

Original reverse compensation and size end

Leetcode652 finding duplicate subtrees

Convolutional Neural Networks in TensorFlow quizs on Coursera

Basic idea of regularization

day 1

Summary of articles in 2020

Analysis of the basic concept of digital warehouse

Machine learning_ Data processing and model evaluation

Hidden Markov model HMM
随机推荐
Analysis of the basic concept of digital warehouse
Installation and use of lsky Pro lancong drawing bed: a drawing bed program for online uploading and managing pictures
day 1
C language implementation of raii
Sword finger offer 47. the maximum value of gifts
MySQL1
Sword finger offer 53 - I. find the number I in the sorted array
Wireshark simple filter rule
Pam4 popular science
Hold the C pointer
Modelarts, Pangu big model, ModelBox... Detailed explanation of Huawei cloud AI development production line
Sequences, time series and prediction in tessorflow quizs on coursera (I)
Day 4 (item 1: household income and expenditure records)
Install SSL Certificate in Litespeed web server
[laser principle and application -6]:q switching element and Q drive circuit board
Ebpf verifier
Chapter 4 compound type
Tcl/tk grouping and replacement rules
Emergency lighting design of large stadiums and gymnasiums
[Huawei lyevk-3861a intelligent IOT development board evaluation] unpacking experience and Hisilicon hi3861v100 chip learning experience