2016ACM青岛区域赛题解
A、Relic Discovery_hdu5982
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 57 Accepted Submission(s): 49
2
1 2
3 4
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int main()
- {
- int n;
- int t;
- int a,b;
- scanf("%d",&t);
- for(int i=;i<t;i++){
- scanf("%d",&n);
- int sum=;
- for(int j=;j<n;j++){
- scanf("%d %d",&a,&b);
- sum+=a*b;
- }
- printf("%d\n",sum);
- }
- return ;
- }
B、Pocket Cube_5983
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 23 Accepted Submission(s): 9
The cube consists of 8 pieces, all corners.
Each piece is labeled by a three dimensional coordinate (h, k, l) where h, k, l ∈ {0, 1}. Each of the six faces owns four small faces filled with a positive integer.
For each step, you can choose a certain face and turn the face ninety degrees clockwise or counterclockwise.
You should judge that if one can restore the pocket cube in one step. We say a pocket cube has been restored if each face owns four same integers.
For each test case, the first line describes the top face of the pocket cube, which is the common 2 × 2 face of pieces
labelled by (0, 0, 1),(0, 1, 1),(1, 0, 1),(1, 1, 1). Four integers are given corresponding to the above pieces.
The second line describes the front face, the common face of (1, 0, 1),(1, 1, 1),(1, 0, 0),(1, 1, 0). Four integers are
given corresponding to the above pieces.
The third line describes the bottom face, the common face of (1, 0, 0),(1, 1, 0),(0, 0, 0),(0, 1, 0). Four integers are
given corresponding to the above pieces.
The fourth line describes the back face, the common face of (0, 0, 0),(0, 1, 0),(0, 0, 1),(0, 1, 1). Four integers are
given corresponding to the above pieces.
The fifth line describes the left face, the common face of (0, 0, 0),(0, 0, 1),(1, 0, 0),(1, 0, 1). Four integers are given
corresponding to the above pieces.
The six line describes the right face, the common face of (0, 1, 1),(0, 1, 0),(1, 1, 1),(1, 1, 0). Four integers are given
corresponding to the above pieces.
In other words, each test case contains 24 integers a, b, c to x. You can flat the surface to get the surface development
as follows.
- + - + - + - + - + - + - +
| q | r | a | b | u | v |
+ - + - + - + - + - + - +
| s | t | c | d | w | x |
+ - + - + - + - + - + - +
| e | f |
+ - + - +
| g | h |
+ - + - +
| i | j |
+ - + - +
| k | l |
+ - + - +
| m | n |
+ - + - +
| o | p |
+ - + - +
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int a[][];
- int b[][];
- bool judge(){
- int i=;
- for(int j=;j<=;j++){
- if(a[j][]==a[j][]&&a[j][]==a[j][]&&a[j][]==a[j][]){
- i++;
- }
- }
- if(i==){
- return true;
- }else{
- return false;
- }
- }
- void opera1(){//前面顺时针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t2;
- a[][]=t1;
- }
- void opera2(){//前面逆时针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t2;
- a[][]=t1;
- }
- void opera3(){//上面顺时针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t1;
- a[][]=t2;
- }
- void opera4(){//上面逆时针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t2;
- a[][]=t1;
- }
- void opera5(){//左边顺指针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t1;
- a[][]=t2;
- }
- void opera6(){//左边逆时针
- int t1,t2;
- t1=a[][];
- t2=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=a[][];
- a[][]=t1;
- a[][]=t2;
- }
- int main()
- {
- int n;
- scanf("%d",&n);
- while(n--){
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- scanf("%d",&a[i][j]);
- b[i][j]=a[i][j];
- }
- }
- if(judge()){
- printf("YES\n");
- continue;
- }
- opera1();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- opera2();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- opera3();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- opera4();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- opera5();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- opera6();
- if(judge()){
- printf("YES\n");
- continue;
- }
- for(int i=;i<=;i++){
- for(int j=;j<=;j++){
- a[i][j]=b[i][j];
- }
- }
- printf("NO\n");
- }
- return ;
- }
C、Pocky_hdu5984
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 54 Accepted Submission(s): 20
While the length of remaining pocky is longer than d, we perform the following procedure. We break the pocky at any point on it in an equal possibility and this will divide the remaining pocky into two parts. Take the left part and eat it. When it is not longer than d, we do not repeat this procedure.
Now we want to know the expected number of times we should repeat the procedure above. Round it to 6 decimal places behind the decimal point.
1.0 1.0
2.0 1.0
4.0 1.0
8.0 1.0
16.0 1.0
7.00 3.00
1.693147
2.386294
3.079442
3.772589
1.847298
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n;
- double a,b;
- scanf("%d",&n);
- while(n--){
- scanf("%lf%lf",&a,&b);
- if(a<=b){
- printf("0.000000\n");
- continue;
- }
- printf("%.6lf\n",log(a)-log(b)+);
- }
- return ;
- }
2016ACM青岛区域赛题解的更多相关文章
- 2016 ACM/ICPC Asia Regional Qingdao Online(2016ACM青岛网络赛部分题解)
2016 ACM/ICPC Asia Regional Qingdao Online(部分题解) 5878---I Count Two Three http://acm.hdu.edu.cn/show ...
- 2016青岛区域赛.Coding Contest(费用流 + 概率计算转换为加法计算)
Coding Contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)To ...
- ACM/ICPC2016 青岛区域赛
A(hdu5982).(模拟) 题意:输入n对数,将每对数相乘并相加 分析:模拟 B(hdu5983).(模拟) 题意:给你一个二阶魔方,问能否通过一次旋转使得给定魔方的每个面颜色相同 分析:模拟 C ...
- 2016ACM-ICPC Qingdao Online青岛网络赛题解
TonyFang+Sps+我=5/12 滚了个大粗 2016年9月21日16:42:36 10题完工辣 01 题意:求形同的数中大于n的最小值 题解:预处理所有的(5194个),在这里面二分 #inc ...
- 2016 年 ACM/ICPC 青岛区域赛 Problem C Pocky
昨晚乱入学弟的训练赛,想了一下这个题.推导的过程中,加深了对公理化的概率论理解.$\newcommand{\d}{\mathop{}\!\mathrm{d}}$ 解法一 考虑 $ d < L$ ...
- 2018 ACM-ICPC南京区域赛题解
解题过程 开场开A,A题shl看错题意,被制止.然后开始手推A,此时byf看错E题题意,开始上机.推出A的规律后,shl看了E题,发现题意读错.写完A题,忘记判断N=0的情况,WA+1.过了A后,sh ...
- Tournament ZOJ - 4063 (青岛区域赛 F 打表)
打表题.. 规律是找出来了 奈何优化不了 .... #include <iostream> #include <cstdio> #include <sstream> ...
- UVALive - 7740 Coding Contest 2016 青岛区域赛 (费用流)
题意:每个点i有\(s_i\)个人和\(b_i\)份食物,每个人都要找到一份食物.现在有M条有向边,从点i到点j,容量为c,第一次走过不要紧,从第二次开始就要承担\(p(0<p<1)\)的 ...
- 第42届亚洲区域赛青岛站(2017icpc青岛)经验总结以及一些感想
上一次写这种东西还是天梯赛,当时打完心里也是挺激动的,然后我们队也没有去参加省赛,但是过了一段时间我还是从那里面恢复了出来.因为我当时确实还是很菜的,当时连个暴力都不会,看着自己仅过的那些百度的题目确 ...
随机推荐
- maven-过滤不打入包的文件
在使用maven打包时,有时有些测试文件,或者配置都希望打入到架包中 此时就需要使用将不用的文件过滤,maven有很方便的过滤插件.因工作时间,暂不讨论.本次讨论一个非常简单除暴的方法,通过配置ecl ...
- Linux下 JDK安装
在linux下安装JDK步骤如下: 第一步:查看Linux自带的JDK是否已安装 (1)查看jdk: [root@web-server ~]# rpm -qa|grep jdk ← 查看jdk的信息或 ...
- hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images
hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images, 本例子主要是使用HTML5 的File API,建立一個可存取到该file的url, 一个空的img标签,ID为img0,把 ...
- 在javascript中使用Json
jSON是JavaScript面向对象语法的一个子集.由于JSON是JavaScript的一个子集,因此它可清晰的运用于此语言中. 文本生成json对象,必须在外面加一对括号. js 代码 var m ...
- 如何在mac本上安装android sdk 避免被墙
众所周知的原因,google的很多网站在国内无法访问,苦逼了一堆天朝程序员,下是在mac本上折腾android 开发环境的过程: 一.先下载android sdk for mac 给二个靠谱的网址: ...
- STL的使用
Vector:不定长数组 Vector是C++里的不定长数组,相比传统数组vector主要更灵活,便于节省空间,邻接表的实现等.而且它在STL中时间效率也很高效:几乎与数组不相上下. #include ...
- bzoj 4610 Ceiling Functi
bzoj 4610 Ceiling Functi Description bzoj上的描述有问题 给出\(n\)个长度为\(k\)的数列,将每个数列构成一个二叉搜索树,问有多少颗形态不同的树. Inp ...
- BZOJ4698: Sdoi2008 Sandy的卡片
差分,枚举一个串的所有后缀,暴力在所有其他串中kmp,复杂度$O(nm^2)$. #include<cstdio> const int N=1005; const int M=105; i ...
- php获得远程信息到本地使用的3个函数:file_get_contents和curl函数和stream_get_contents
1:file_get_contents echo file_get_contents("http://www.php.com/index.php"); 2:curl funct ...
- python发送邮件
python发送邮件(无附件) ======================================================= #!/usr/bin/env python#coding ...