先写下总结,当时第三题被黑了是好事情。自己当时想到了那种三个圆相切的局面,但后来又被自己给否定了,应该多画画图就出来了,不应该那样老是空想。而且需要搞个圆规了!

A. Xenia and Divisors
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held:

  • a < b < c;
  • a divides bb divides c.

Naturally, Xenia wants each element of the sequence to belong to exactly one group of three. Thus, if the required partition exists, then it has  groups of three.

Help Xenia, find the required partition or else say that it doesn't exist.

Input

The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7.

It is guaranteed that n is divisible by 3.

Output

If the required partition exists, print  groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them.

If there is no solution, print -1.

Sample test(s)
input
6
1 1 1 2 2 2

output
-1

input
6
2 2 1 1 4 6

output
1 2 4
1 2 6

题目大意:那个divides是整除的意思,开始看了一段时间,小数除以大数什么意思?给你1-7很多数,分成很多组,每组有a,b,c,a<b<c且a|b,b|c。解题思路就很简单了,因为只能a<b<c,并且有整除关系只有1 2 4 ,1 2 6, 1 3 6三组。假设1,2,4的个数为a个,1, 2, 6的个数为b个,1, 3, 6的个数为c个。1就有a+b+c,2就有a+b,3就有c,4就有a,6就有b+c,5和7是0。这样判断即可。详见代码。

题目地址:A. Xenia and Divisors

AC代码:

#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int p[8];int main()
{int i,n,x;while(~scanf("%d",&n)){memset(p,0,sizeof(p));for(i=0;i<n;i++){scanf("%d",&x);p[x]++;}if(p[5]>0||p[7]>0){puts("-1");continue;}int a,b,c;a=p[4],c=p[3],b=p[1]-a-c;if(b<0)puts("-1");else{if(p[2]==a+b&&p[6]==b+c){for(i=0;i<a;i++)printf("1 2 4\n");for(i=0;i<b;i++)printf("1 2 6\n");for(i=0;i<c;i++)printf("1 3 6\n");}elseputs("-1");}}return 0;
}
B. Xenia and Spies
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.

Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the note to one of his neighbours in the row. In other words, if this spy's number is x, he can pass the note to another spy, either x - 1 or x + 1 (if x = 1 or x = n, then the spy has only one neighbour). Also during a step the spy can keep a note and not pass it to anyone.

But nothing is that easy. During m steps Xenia watches some spies attentively. Specifically, during step ti (steps are numbered from 1) Xenia watches spies numbers li, li + 1, li + 2, ..., ri (1 ≤ li ≤ ri ≤ n). Of course, if during some step a spy is watched, he can't do anything: neither give the note nor take it from some other spy. Otherwise, Xenia reveals the spies' cunning plot. Nevertheless, if the spy at the current step keeps the note, Xenia sees nothing suspicious even if she watches him.

You've got s and f. Also, you have the steps during which Xenia watches spies and which spies she is going to watch during each step. Find the best way the spies should act in order to pass the note from spy s to spy f as quickly as possible (in the minimum number of steps).

Input

The first line contains four integers nms and f (1 ≤ n, m ≤ 105; 1 ≤ s, f ≤ ns ≠ fn ≥ 2). Each of the following m lines contains three integers ti, li, ri (1 ≤ ti ≤ 109, 1 ≤ li ≤ ri ≤ n). It is guaranteed that t1 < t2 < t3 < ... < tm.

Output

Print k characters in a line: the i-th character in the line must represent the spies' actions on step i. If on step i the spy with the note must pass the note to the spy with a lesser number, the i-th character should equal "L". If on step i the spy with the note must pass it to the spy with a larger number, the i-th character must equal "R". If the spy must keep the note at the i-th step, the i-th character must equal "X".

As a result of applying the printed sequence of actions spy s must pass the note to spy f. The number of printed characters k must be as small as possible. Xenia must not catch the spies passing the note.

If there are miltiple optimal solutions, you can print any of them. It is guaranteed that the answer exists.

Sample test(s)
input
3 5 1 3
1 1 2
2 2 3
3 3 3
4 1 1
10 1 3

output
XXRR

题目大意:给你n个人,每次只能往左走一步,或往右走一步。从s走到f问你最小走的路径,但是有m个规定,规定在第ti步的时候,从li到ri的位置都不能动。我的想法就是每次要么停着X,要么往右走。开始把if(s>f) swap(s,f)。开始犯2了。那样的话,需要输出往左走就只能哭瞎了!如果s<f要么停着X,要么往右走,如果s>f要么停着X,要么往左走。具体见代码。

AC代码:

#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int t[100005],l[100005],r[100005];  int main()
{int n,m,s,f,i;while(~scanf("%d%d%d%d",&n,&m,&s,&f)){if(s<f)  //往右走或停{for(i=1; i<=m; i++)scanf("%d%d%d",&t[i],&l[i],&r[i]);int step=1;int pos=1;while(s<f)  //如果s<f就停止{while(t[pos]<step) pos++;  //比它步数小的都过滤掉if(step<t[pos]){s++;step++;cout<<"R";}else if(step==t[pos]){if(s<l[pos]-1||s>r[pos])  //不在li到ri之内{s++;step++;cout<<"R";}else  在li到ri之内{step++;cout<<"X";}}}cout<<endl;}else  //往左走或停{for(i=1; i<=m; i++)scanf("%d%d%d",&t[i],&l[i],&r[i]);int step=1;int pos=1;while(s>f){while(t[pos]<step) pos++;if(step<t[pos]){s--;step++;cout<<"L";}else if(step==t[pos]){if(s>r[pos]+1||s<l[pos])  //不在li到ri之内{s--;step++;cout<<"L";}else  //在li到ri之内{step++;cout<<"X";}}}cout<<endl;}}return 0;
}/*
3 5 1 3
1 1 2
2 2 3
3 3 3
4 1 1
10 1 3
3 5 3 1
1 1 2
2 2 3
3 3 3
4 1 1
10 1 3
*/
C. Cupboard and Balloons
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h + r from the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right).

Xenia got lots of balloons for her birthday. The girl hates the mess, so she wants to store the balloons in the cupboard. Luckily, each balloon is a sphere with radius . Help Xenia calculate the maximum number of balloons she can put in her cupboard.

You can say that a balloon is in the cupboard if you can't see any part of the balloon on the left or right view. The balloons in the cupboard can touch each other. It is not allowed to squeeze the balloons or deform them in any way. You can assume that the cupboard's walls are negligibly thin.

Input

The single line contains two integers r, h (1 ≤ r, h ≤ 107).

Output

Print a single integer — the maximum number of balloons Xenia can put in the cupboard.

Sample test(s)
input
1 1

output
3

input
1 2

output
5

input
2 1

output
2

题目大意:题目意思很简单,左边的是正面图,右边的图片是左视图。问你放半径为r/2.0的球最多能放多少个。由于半径是r/2.0,直接可以转换为二维平面上能含最多的圆。这个题目主要需要分类讨论,详见代码,开始只分了两类。但是结果被黑了,待会儿下面有图解,主要是有一种情况没有看到。在最后的十分钟的时候看到这个问题,当时没有认真想三圆相切,而是直接飘过了。。没有动笔画图的缺点暴露了。。

详见AC代码:

#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;int main()
{double h,r;int sum=0;while(~scanf("%lf%lf",&r,&h)){int p=(int)(h/r);if(h-r*p>=r/2.0*(sqrt(3.0)))sum=p*2+3;else if(h-r*p>=r/2.0)sum=p*2+2;elsesum=p*2+1;cout<<sum<<endl;}return 0;
}

刚为了准备画图,结果重新下ps cs6结果中木马了,桌面动不了了。开机了最后dns服务也被篡改了。搞了半天还是搞好了。。。!

打开网络中心--网络适配器。。ip可以自动获取没得问题。主要是dns服务器地址。当你可以上网的时候就按此处操作:点击左下角“开始”——“运行”—— 输入“cmd”确定——在命令提示符中输入“ipconfig/all”,之后就会显现DMS服务器地址,记住那个地址,把那个dns地址在本地连接的属性中写入就不会断网了。(开始上网时候都是自动获取的) 。

Codeforces #199前三题相关推荐

  1. 蓝桥杯单片机十一届省赛_“第十届蓝桥杯青少组C++省赛”前三题解题思路及参考答案!...

    关注 及时了解信息学竞赛相关资讯 第十一届蓝桥杯青少组C++省赛即将到来,待考的各位小同学有没有刷完去年的真题呢?以下是为大家复习准备的"第十届蓝桥杯青少组C++省赛"前三题解题思 ...

  2. NOIP2008提高组(前三题) -SilverN

    此处为前三题,第四题将单独发布 火柴棒等式 题目描述 给你n根火柴棍,你可以拼出多少个形如"A+B=C"的等式?等式中的A.B.C是用火柴棍拼出的整数(若该数非零,则最高位不能是0 ...

  3. codeforces CodeTON Round 1 (Div. 1 + Div. 2, Rated, Prizes) Editorial前三题讲解

    前提声明:题目均已开中文翻译,可能会有偏差,但不影响理解!!! 目录 A 题目 代码 讲解 B 题目 代码 讲解 C 题目 代码 讲解 A 题目 您将获得一个数组a_1.a_2.\ldots.a_n一 ...

  4. C语言程序设计上机前三题,C语言程序设计(含上机实验与习题解答)

    本书根据作者多年来教授不同基础学员的经验,针对初学者的特点,由浅入深,从一般程序设计语言的共性到C语言自身的特性,从C语言的语法规则到其内部实现,对C语言进行了系统的介绍. 全书分上.下两篇.上篇介绍 ...

  5. 2020年百度之星·程序设计大赛 - 初赛一(前三题)

    文章目录 Drink[贪心] 题目描述 测试样例 解题思路 赛时AC代码 赛后优化AC代码 总结: GPA[枚举] 题目描述 测试样例 解题思路 赛时WA代码 赛时AC代码 总结: Dec[反向dp+ ...

  6. 高等数学(第七版)同济大学 总习题三(前10题) 个人解答

    高等数学(第七版)同济大学 总习题三(前10题) 1.填空:设常数k>0,函数f(x)=lnx−xe+k在(−,+∞)内零点的个数为:\begin{aligned}&1. \ 填空:设常 ...

  7. codeforces 有意思的思维题 1 ~ 15

    codeforces 思维题 1.给定数组,求满足i < j and ai * aj = i + j的数对数量 2.第 i 步向前跳 i 步或后退 1 步 3.给两个点,求正方形的另两个点 4. ...

  8. 2011年成都信息工程学院第二季极客大挑战逆向第三题Game破文

    [文章标题]: 2011年成都信息工程学院第二季极客大挑战逆向第三题Game破文 [文章作者]: JoyChou [软件名称]: Game [软件大小]: 176KB [下载地址]: http://w ...

  9. 逻辑思维训练500题(带答案)前237题 文末附完整版PDF

    第一章 假设法 一个真实的假设往往可以让事实呈现眼前,让真理浮出水面.一个人如果做什么事都可以让其思维以这些假设前提为基础,那么他便能真真正正地活在NLP里而不会陷入困境,他的人生也就会有更大地进步和 ...

最新文章

  1. python numpy的部分函数
  2. Django从理论到实战(part19)--DTL模板语法
  3. Java爬取并下载酷狗音乐
  4. MEDIATR 一个低调的中介者类库
  5. Promise 原理解析与实现(遵循Promise/A+规范)
  6. 作者:陈卫, 男, 微软亚洲研究院高级研究员, 清华大学客座教授。
  7. iOS 关于BTC 一些知识点
  8. 【心情】换个皮肤试试看
  9. tekla钢结构算量_钢结构、Tekla及建筑工业化厂商对Tekla软件的开发和应用
  10. NBA20-21赛季数据分析 | Python数据分析及可视化实战
  11. Webcontent 和WebRoot的区别
  12. QMT量化交易网格交易 源码
  13. 苏宁API:item_get - 获得suning商品详情
  14. nginx配置前端网站
  15. hbuilderx gitee操作教程
  16. 【微信小程序】自定义弹窗蒙版输入框效果图完整代码
  17. SQLPro Studio for Mac(可视化数据库管理工具)
  18. 关于工资结算的C语言程序,C语言程序设计,纳税工资系统
  19. 2019电赛--OpenMV学习笔记
  20. 小技巧: 掀开 Metacity 的同化殊效

热门文章

  1. zookeeper 集群搭建及常见问题解决(虚拟机)
  2. pxelinux_IT怪胎:如何使用PXElinux v5和Wimboot网络引导(PXE)WinPE恢复磁盘
  3. 【JavaEE】详解 “进程”
  4. Detect-SLAM阅读笔记
  5. 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之27---BREW 应用定价
  6. 《软技能-代码之外的生存指南》读书笔记
  7. 局部色调映射(Local Tone Mapping)
  8. Bilateral Filter、Cross/Joint Bilateral Filter
  9. 杨毅-kafka集群部署
  10. 红队、蓝队和紫队组合:安全保障的协作方法