当前位置:网站首页>Red's deleted number
Red's deleted number
2022-06-12 02:21:00 【whitewall_ nine】
Classification of discussion sum%3 == 0, == 1 == 2
among sum%3 == 0 Can be applied to =1, be equal to 2 The situation of
Be careful n = 1 Etc Judgment of the situation
And when the condition for Xiaozi to win is equal to %2==1 When the sum is not equal to >2
The important method is to enumerate the special cases , Enumerate from quantity , There are only three equivalence classes
// Problem: Xiao Hong's deleted number
// Contest: NowCoder
// URL: https://ac.nowcoder.com/acm/contest/11251/C
// Memory Limit: 524288 MB
// Time Limit: 2000 ms
// 2022-06-10 20:17:47
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define mp make_pair
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> Vll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const double pi = acos(-1.0);
inline ll ksc(ll x,ll y,ll mod)
{
ll ans = 0;
while (y) {
if (y & 1)
ans = (ans + x) %mod;
y >>= 1;
x = (x + x) %mod;
}
return ans;
}
inline ll qmi (ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1) ans = ans * a;
a = a * a;
b >>= 1;
}
return ans;
}
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
inline ll sub (ll a, ll b) {
return ((a - b ) %mod + mod) %mod;
}
inline ll add (ll a, ll b) {
return (a + b) %mod;
}
// inline ll inv (ll a) {
// return qmi(a, mod - 2);
// }
int num[5];
int n, sum;
string s;
void solve() {
cin >> s;
for (auto t : s) {
int c = t - '0';
if (c == 0) continue;
n ++;
c%=3;
num[c] ++;
sum += t -'0';
}
if (sum % 3 == 0) {
if (num[0] == 0 || n <= 1) {
puts("yukari");
return;
}
num[0] --;
n --;
if (num[0] == 0) {
if (n == 1) {
puts("kou");
return;
}
if (num[1] != num[2] && abs(num[1] - num[2]) > 1
|| (num[1] == num[2] && num[1]%2))
{
puts("yukari") ;
}
else puts("kou");
}
else {
if (num[1] != num[2])
puts("yukari");
else
{
puts("kou");
}
}
}
else if (sum % 3 == 1) {
if (num[1] == 0 || n <= 1) {
puts("yukari");
return;
}
num[1] --;
n --;
if (num[0] == 0) {
if (n == 1) {
puts("kou");
return;
}
if (num[1] != num[2] && abs(num[1] - num[2]) > 1
|| (num[1] == num[2] && num[1]%2))
{
puts("yukari") ;
}
else puts("kou");
}
else {
if (num[1] != num[2])
puts("yukari");
else
{
puts("kou");
}
}
}
else if (sum % 3==2) {
if (num[2] == 0 || n <= 1) {
puts("yukari");
return;
}
num[2] --;
n --;
if (num[0] == 0) {
if (n == 1) {
puts("kou");
return;
}
if (num[1] != num[2] && abs(num[1] - num[2]) > 1
|| (num[1] == num[2] && num[1]%2))
{
puts("yukari") ;
}
else puts("kou");
}
else {
if (num[1] != num[2])
puts("yukari");
else
{
puts("kou");
}
}
}
}
int main () {
// ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
int t;
t =1;
//cin >> t;
while (t --) solve();
return 0;
}
边栏推荐
- Start ticwatch2
- Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)
- Almost all schools will ask for the second round exam! Come in and recite the answer!
- 力扣解法汇总944-删列造序
- virsh创建/关闭/停止虚拟机常用的几条指令
- Ozzanmation action system based on SSE
- Force deduction solution summary 388- longest absolute path of file
- 高考完不要急着去打工了,打工以后有的是机会,不差这三个月
- Proxy and reflection (II)
- Force deduction solution summary 883- projected area of 3D shape
猜你喜欢

Implementation scheme of iteration and combination pattern for general tree structure

Oracle 11g graphic download installation tutorial (step by step)

How WPS inserts a directory and the operating steps for quickly inserting a directory

Don't miss it! Five large data visualization screens that HR must collect

matplotlib. pyplot. Bar chart (II)

Ue4\ue5 touch screen touch event: single finger and double finger

MySQL table common operation mind map

通用树形结构的迭代与组合模式实现方案

ozzanimation-基于sse的动作系统

ACL 2022 - strong combination of pre training language model and graphic model
随机推荐
程序员应该如何解决买菜难问题?手把手带你利用无障碍辅助功能快速下单抢菜
Force deduction solution summary 398 random number index
力扣解法汇总-剑指 Offer II 114. 外星文字典
2022最全面的Redis事务控制(带图讲解)
博创智能冲刺科创板:年营收11亿 应收账款账面价值3亿
力扣解法汇总-04.06. 后继者
ACL 2022 | 预训练语言模型和图文模型的强强联合
力扣解法汇总905-按奇偶排序数组
Force deduction solution summary 965- single valued binary tree
Alicloud OSS file upload system
Installing MySQL version 5.5 database for Linux (centos6)
Force deduction solution summary 388- longest absolute path of file
力扣解法汇总883-三维形体投影面积
小红的删数字
Is there a female Bluetooth headset suitable for girls? 38 Bluetooth headsets worth getting started
通用树形结构的迭代与组合模式实现方案
MySQL advanced knowledge points
力扣解法汇总462-最少移动次数使数组元素相等 II
力扣编程题-解法汇总
Force deduction solution summary -04.06 Successor