当前位置:网站首页>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;
}
边栏推荐
- 力扣解法汇总面试题 01.05. 一次编辑
- Graphic data analysis | data cleaning and pretreatment
- Xiaopi can't start the MySQL database. Please find out!
- Force deduction solution summary 824 goat Latin
- Knowledge points of mall development
- xcall 集群脚本(查看jps命令)
- Xcall cluster script (view JPS command)
- El upload upload file
- Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)
- Force deduction programming problem - solution summary
猜你喜欢

The release of star ring kundb 2.2 provides a new choice for business systems with high concurrent transactions and queries

Master of a famous school has been working hard for 5 years. AI has no paper. How can the tutor free range?

MySQL table common operation mind map

Basedexclassloader
![[adjustment] in 2022, the Key Laboratory of laser life sciences of the Ministry of education of South China Normal University enrolled adjustment students in optics, electronic information, biomedicin](/img/f9/332b206d5aca0ca6afc3fdf11a53c8.jpg)
[adjustment] in 2022, the Key Laboratory of laser life sciences of the Ministry of education of South China Normal University enrolled adjustment students in optics, electronic information, biomedicin

Proxy and reflection (II)

BaseDexClassLoader那些事

Graduation design of fire hydrant monitoring system --- thesis (add the most comprehensive hardware circuit design - > driver design - > Alibaba cloud Internet of things construction - > Android App D

RPA introduction

Abaqus中批量对节点施加集中力荷载
随机推荐
Ue4\ue5 touch screen touch event: single finger and double finger
Force deduction solution summary 824 goat Latin
Summary of force deduction method 417- Pacific Atlantic current problems
Start ticwatch2
$. map(data,function(item,index){return XXX})
Force deduction solution summary 467- unique substring in surrounding string
消防栓监测系统毕业设计---论文(附加最全面的从硬件电路设计->驱动程序设计->阿里云物联网搭建->安卓APP设计)
Transformation of geographical coordinates of wechat official account development
How WPS inserts a directory and the operating steps for quickly inserting a directory
String number with special style
ACL 2022 | 预训练语言模型和图文模型的强强联合
Force deduction solution summary 868- binary spacing
2022 western style pastry (technician) recurrent training question bank and online simulated examination
Swiftyjson analyse les fichiers json locaux
高考完不要急着去打工了,打工以后有的是机会,不差这三个月
力扣解法汇总699-掉落的方块
Force deduction solution summary 942- increase / decrease string matching
Basedexclassloader
RPA introduction
[no title] 2022 coal mine safety inspection test questions and online simulation test