国庆个人第四场

Little C Loves 3 I

Description

Little C loves number «3» very much. He loves all things about it.

Now he has a positive integer nn. He wants to split nn into 33 positive integers a,b,ca,b,c, such that a+b+c=na+b+c=n and none of the 33 integers is a multiple of 33. Help him to find a solution.

Input

A single line containing one integer nn (3≤n≤1093≤n≤109) — the integer Little C has.

Output

Print 33 positive integers a,b,ca,b,c in a single line, such that a+b+c=na+b+c=n and none of them is a multiple of 33.

It can be proved that there is at least one solution. If there are multiple solutions, print any of them.

Sample Input

Input

3

Output

1 1 1

Input

233

Output

77 77 79

题目意思:给你一个数n,要求将n分成3分,并且每一份都不能被3整除。解题思路:直接构造就好了。目的就是为了防止出现划分出的数是3的倍数,我们就将n按照是不是3的倍数分为两类。
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 int main()
 6 {
 7     int n;
 8     int a,b,c;
 9     scanf("%d",&n);
10     if(n%3==0)
11     {
12         a=1;
13         b=1;
14         c=n-2;
15     }
16     else if(n%3==1||n%3==2)
17     {
18         a=1;
19         b=2;
20         c=n-3;
21     }
22     printf("%d %d %d\n",a,b,c);
23     return 0;
24 }

Cover Points

Description

There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn).

You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle or on the side of the triangle). Calculate the minimum length of the shorter side of the triangle.

Input

First line contains one integer nn (1≤n≤1051≤n≤105).

Each of the next nn lines contains two integers xixi and yiyi (1≤xi,yi≤1091≤xi,yi≤109).

Output

Print the minimum length of the shorter side of the triangle. It can be proved that it‘s always an integer.

Sample Input

Input

31 11 22 1

Output

3

Input

41 11 22 12 2

Output

4

Hint

Illustration for the first example: 

Illustration for the second example: 


题目意思:求一个能将所有点覆盖掉的最小等腰三角形的腰长。解题思路:很水,找一个坐标(x,y),x+y最大的那个点的x+y值即为能够覆盖的最小等腰三角形的腰长!可以通过平移得到。
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 int main()
 6 {
 7     int n,i,x,y,sum;
 8     int maxs=-9999;
 9     scanf("%d",&n);
10     for(i=1; i<=n; i++)
11     {
12         scanf("%d%d",&x,&y);
13         sum=x+y;
14         if(sum>maxs)
15         {
16             maxs=sum;
17         }
18     }
19     printf("%d\n",maxs);
20     return 0;
21 }


Description

Karen is getting ready for a new school day!

It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome.

What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome?

Remember that a palindrome is a string that reads the same forwards and backwards. For instance, 05:39 is not a palindrome, because05:39 backwards is 93:50. On the other hand, 05:50 is a palindrome, because 05:50 backwards is 05:50.


Input

The first and only line of input contains a single string in the format hh:mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59).


Output

Output a single integer on a line by itself, the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome.


Sample Input

Input

05:39

Output

11

Input

13:31

Output

0

Input

23:59

Output

1

Hint

In the first test case, the minimum number of minutes Karen should sleep for is 11. She can wake up at 05:50, when the time is a palindrome.

In the second test case, Karen can wake up immediately, as the current time, 13:31, is already a palindrome.

In the third test case, the minimum number of minutes Karen should sleep for is 1 minute. She can wake up at 00:00, when the time is a palindrome.

题目意思:女主角要在回文时刻起床,给你一个时刻,问到距离下一个回文时刻,女主角还能睡多久。解题思路:开始我一直在找小时和分钟关于回文的对称关系,希望能找到规律,后来一直出错,因为会有小时进位问题,后来改成直接暴力模拟,AC。
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 char s[10];
 6 int main()
 7 {
 8     int h,m,a,b;
 9     int ans;
10     gets(s);
11     h=s[1]-‘0‘+(s[0]-‘0‘)*10;
12     m=s[4]-‘0‘+(s[3]-‘0‘)*10;
13     ans=0;
14     //printf("%d %d\n",h,m);
15     while(1)
16     {
17         if(m%10==h/10&&h%10==m/10)///该起床了
18         {
19             break;
20         }
21         m++;
22         ans++;
23         if(m==60)
24         {
25             m=0;
26             h++;
27         }
28         if(h==24)
29         {
30             h=0;
31         }
32     }
33     printf("%d\n",ans);
34     return 0;
35 }



原文地址:https://www.cnblogs.com/wkfvawl/p/9743313.html

时间: 2024-07-31 10:22:34

国庆个人第四场的相关文章

2018SDIBT_国庆个人第四场

A - A  这题很巧妙啊,前两天刚好做过,而且就在博客里 Little C Loves 3 I time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little C loves number «3» very much. He loves all things about it. Now he has a positive int

计蒜客 2016计蒜之道比赛 初赛第四场 记录

T1  淘宝流量分配 在每年的淘宝“双十一”时,访问量都会暴涨,服务器的请求会被流量分配程序按照一定策略,分发给不同的进程去处理.有一类请求,有两个进程可以接受分发的请求,其中一个进程所在服务器的配置.网络传输性能等都要优于另一个进程.流量分发程序可以知道队列中每个任务的预计处理时间,每次都会尽可能将队列中预计处理时间更多的任务分配给性能更优的进程. 假设队列当前一共有 nn 个任务待分配,第 ii 个任务的预计处理时间为 a_i(1 \leq i \leq n)a?i??(1≤i≤n).由于服

HDOJ多校联合第四场

B题: C题:仅由'A','G','C','T',4个字母组成,给定一个字符串S,|S|<=15,给定一个整数m,以m为长度且仅含4种字母的字符串T,求LCS(S,T)为0,1,2,3....|S|,时相应字符串T的数目. 分析:dp+状态压缩 反正我不会这题,也是看了羊神的代码之后才明白这题的思路 下面说说我的理解吧: 由于|S|长度最大为15,所以用一个二进制编码表示是哪些位置上的字母构成LCS,并求相应的数目. dp[0][st],dp[1][st]记录的是相应字母构成LCS时,T可能的数

hdu5336 多校联合第四场1010 模拟+bfs优先队列

http://acm.hdu.edu.cn/showproblem.php?pid=5336 Problem Description XYZ is playing an interesting game called "drops". It is played on a r?c grid. Each grid cell is either empty, or occupied by a waterdrop. Each waterdrop has a property "siz

[hdu 4899]14年多校第四场C Hero meet devil 状压DP

Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 122    Accepted Submission(s): 49 Problem Description There is an old country and the king fell in love with a devil. The devil always asks th

STD 第四场 1001 1002 1004

HDU 5327 5328 5335 #include <stdio.h> #include <iostream> #include <string.h> #include <stack> #include <algorithm> #include <queue> #include <map> #include <cmath> #define eps 0.00000001 #define pi acos(-1,

2014多校第四场1005 || HDU 4901 The Romantic Hero (DP)

题目链接 题意 :给你一个数列,让你从中挑选一些数组成集合S,挑另外一些数组成集合T,要求是S中的每一个数在原序列中的下标要小于T中每一个数在原序列中下标.S中所有数按位异或后的值要与T中所有的数按位与的值相同,问能找出多少符合要求的组合. 思路 :比赛的时候有点没有头绪,后来二师兄想出了状态转移方程,YN又改了很多细节,最后才A的.总之是个别扭的DP..... 一开始是 _xor[i][j^a[i]] += _xor[i-1][j] :j 的下一个状态 就是异或上a[i],这个数组所代表的意思

多校第四场

P1006:真不会线段树,更不会带LAZY的线段树. 思想就是延迟标记 #include<stdio.h> #include<algorithm> #include<string.h> #include<math.h> #include<iostream> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define N 111

计蒜之道2015程序设计大赛初赛第四场——爱奇艺的自制节目

计蒜之道2015程序设计大赛初赛第四场——爱奇艺的自制节目 (一)题面 爱奇艺作为一家视频网站巨头,要为上亿的用户每天都提供“悦享品质”的服务.除了引进一些优秀的影视作品外,爱奇艺还做了一些诸如奇葩说.晓松奇谈的自制节目.爱奇艺最近又准备制作四档新的节目,它们分别是 W, X, Y, Z:但是现在能用来录这些节目的演播室只有两个,分别是演播室 A 和演播室 B. W 节目的现场搭建比较复杂,每一期都要在演播室 A 来录制,X 节目的摄影机位调整会影响节目质量,每一期都固定在演播室 B 来录制.而