[Codeforces Round #635 (div2)]1337


1337A - Ichihime and Triangle[思维]
1337B - Kana and Dragon Quest game[思维]
1337C - Linova and Kingdom[ d f s dfs dfs][贪心]
1337D - Xenia and Colorful Gems[二分][枚举]
1337E - Kaavi and Magic Spell[ d p dp dp]
1337F - Yui and Mahjong Set[ ]




吐个槽
果然这一场是雀魂场把
每题都带个表情包

在这里插入图片描述





目录

1337A - Ichihime and Triangle[思维]

time limit per testmemory limit per testinputoutput
1 seconds256 megabytesstandard inputstandard output

Description:

Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.

These days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this time the prize for the winner is her favorite — cookies. Ichihime decides to attend the contest. Now she is solving the following problem.

You are given four positive integers a , b , c , d a, b, c, d a,b,c,d, such that
a ≤ b ≤ c ≤ d a≤b≤c≤d abcd.

Your task is to find three integers x , y , z x, y, z x,y,z, satisfying the following conditions:
a ≤ x ≤ b . b ≤ y ≤ c . c ≤ z ≤ d a≤x≤b.\\b≤y≤c.\\c≤z≤d axb.byc.czd.
There exists a triangle with a positive non-zero area and the lengths of its three sides are x , y , x, y, x,y, and z z z.

Ichihime desires to get the cookie, but the problem seems too hard for her. Can you help her?

Input

The first line contains a single integer t ( 1 ≤ t ≤ 1000 ) t(1≤t≤1000) t(1t1000) — the number of test cases.

The next t lines describe test cases. Each test case is given as four space-separated integers a , b , c , d ( 1 ≤ a ≤ b ≤ c ≤ d ≤ 1 0 9 ) a, b, c, d (1≤a≤b≤c≤d≤10^9) a,b,c,d(1abcd109).

Output

For each test case, print three integers x , y , z x, y, z x,y,z — the integers you found satisfying the conditions given in the statement.

It is guaranteed that the answer always exists. If there are multiple answers, print any.

Example input

4
1 3 5 7
1 5 5 7
100000 200000 300000 400000
1 1 977539810 977539810

Example output

3 4 5
5 5 5
182690 214748 300999
1 977539810 977539810

Hit

One of the possible solutions to the first test case:

One of the possible solutions to the second test case:

分析:

题意:
x , y , z x, y, z x,y,z,这三个数满足
a ≤ x ≤ b . b ≤ y ≤ c . c ≤ z ≤ d a≤x≤b.\\b≤y≤c.\\c≤z≤d axb.byc.czd
且可以组成三角形
做法:
显然只要两条边相等就可以了
y = z = c , a ≤ x ≤ b y = z = c, a \leq x \leq b y=z=c,axb即可

Code:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 5;

int main() {
    int T;
    scanf("%d", &T);
    while(T--) {
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        printf("%d %d %d\n", a, c, c);
    }
    return 0;
}





目录

1337B - Kana and Dragon Quest game[思维]

time limit per testmemory limit per testinputoutput
1 seconds256 megabytesstandard inputstandard output

Description:

Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is also a gameholic.

One day Kana gets interested in a new adventure game called Dragon Quest. In this game, her quest is to beat a dragon.
The dragon has a hit point of x initially. When its hit point goes to 0 or under 0, it will be defeated. In order to defeat the dragon, Kana can cast the two following types of spells.

a. V o i d Void Void A b s o r p t i o n Absorption Absorption
Assume that the dragon’s current hit point is h, after casting this spell its hit point will become ⌊ h 2 ⌋ + 10 ⌊h2⌋+10 h2+10. Here ⌊ h 2 ⌋ ⌊h2⌋ h2 denotes h h h divided by two, rounded down.
b. L i g h t n i n g Lightning Lightning S t r i k e Strike Strike
This spell will decrease the dragon’s hit point by 10 10 10. Assume that the dragon’s current hit point is h, after casting this spell its hit point will be lowered to h − 10 h−10 h10.

Due to some reasons Kana can only cast no more than n n n V o i d Void Void A b s o r p t i o n s Absorptions Absorptions and m m m L i g h t n i n g Lightning Lightning S t r i k e s Strikes Strikes. She can cast the spells in any order and doesn’t have to cast all the spells. Kana isn’t good at math, so you are going to help her to find out whether it is possible to defeat the dragon.

Input

The first line contains a single integer t ( 1 ≤ t ≤ 1000 ) t (1≤t≤1000) t(1t1000) — the number of test cases.

The next t t t lines describe test cases. For each test case the only line contains three integers x , n , m ( 1 ≤ x ≤ 1 0 5 , 0 ≤ n , m ≤ 30 ) x, n, m (1≤x≤10^5, 0≤n,m≤30) x,n,m(1x105,0n,m30) — the dragon’s intitial hit point, the maximum number of Void Absorptions and Lightning Strikes Kana can cast respectively.

Output

If it is possible to defeat the dragon, print “YES” (without quotes). Otherwise, print “NO” (without quotes).

You can print each letter in any case (upper or lower).

Example input

7
100 3 4
189 3 4
64 2 3
63 2 3
30 27 7
10 9 1
69117 21 2

Example output

YES
NO
NO
YES
YES
YES
YES

Hit

One possible casting sequence of the first test case is shown below:
V o i d Void Void A b s o r p t i o n Absorption Absorption ⌊ 100 2 ⌋ + 10 = 60 ⌊\frac{100}{2}⌋+10=60 2100+10=60.
L i g h t n i n g Lightning Lightning S t r i k e Strike Strike 60 − 10 = 50 60−10=50 6010=50.
V o i d Void Void A b s o r p t i o n Absorption Absorption ⌊ 50 2 ⌋ + 10 = 35 ⌊\frac{50}{2}⌋+10=35 250+10=35.
V o i d Void Void A b s o r p t i o n Absorption Absorption ⌊ 35 2 ⌋ + 10 = 27 ⌊\frac{35}{2}⌋+10=27 235+10=27.
L i g h t n i n g Lightning Lightning S t r i k e Strike Strike 27 − 10 = 17 27−10=17 2710=17.
L i g h t n i n g Lightning Lightning S t r i k e Strike Strike 17 − 10 = 7 17−10=7 1710=7.
L i g h t n i n g Lightning Lightning S t r i k e Strike Strike 7 − 10 = − 3 7−10=−3 710=3.

分析:
题意:
怪物血量为 x x x,问是否能使怪物的血量变为 x ≤ 0 x \leq 0 x0
有两种操作,
第一种可以使 x = ⌊ x 2 ⌋ + 10 x = ⌊\frac{x}{2}⌋ + 10 x=2x+10
第二种可以使 x = x − 10 x = x - 10 x=x10
其中 ⌊ x ⌋ ⌊x⌋ x 表示向下取整

做法:
只要判断 ⌊ x 2 ⌋ + 10 ≤ x − 10 ⌊\frac{x}{2}⌋ + 10 \leq x - 10 2x+10x10 是否成立,且 n ! = 0 n != 0 n!=0
这种情况下就可以使用第一种
否则如果 m ! = 0 m != 0 m!=0,使用第二种

Code:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 5;

int main() {
    int T;
    scanf("%d", &T);
    while(T--) {
        int x, n, m, ans;
        scanf("%d%d%d", &x, &n, &m);
        while(x > 0 && (m || n)) {
            int ans = x / 2 + 10;
            if(n > 0 && ans < x) 
                x = ans, n -= 1;
            else if(m > 0)
                x = x - 10, m -= 1;
            else 
                break;
        }
        if(x > 0)   puts("NO");
        else        puts("YES");
    }
    return 0;
}





目录

哇这题我是真的没看懂
查了一下发现题解也很长
有空的时候在来看看
题解传送门 [codeforces 1337F] Yui and Mahjong Set 公式推导+交互式程序的测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值