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

Problem Description
Recently, paleoanthropologists have found historical remains on an island in the Atlantic Ocean. The most inspiring thing is that they excavated in a magnificent cave and found that it was a huge tomb. Inside the construction,researchers identified a large number of skeletons, and funeral objects including stone axe, livestock bones and murals. Now, all items have been sorted, and they can be divided into N types. After they were checked attentively, you are told that there areAi items of the i-th type. Further more, each item of the i-th type requires Bi million dollars for transportation, analysis, and preservation averagely. As your job, you need to calculate the total expenditure.
 
Input
The first line of input contains an integer T which is the number of test cases. For each test case, the first line contains an integer N which is the number of types. In the next N lines, the i-th line contains two numbers Ai and Bi as described above. All numbers are positive integers and less than 101.
 
Output
For each case, output one integer, the total expenditure in million dollars.
 
Sample Input
1
2
1 2
3 4
 
Sample Output
14
 
Source
 
Recommend
jiangzijing2015   |   We have carefully selected several similar problems for you:  5994 5993 5992 5991 5990 
思路:第一题很简单,求费用,把每次的乘积都加起来就行了。
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n;
  9. int t;
  10. int a,b;
  11. scanf("%d",&t);
  12. for(int i=;i<t;i++){
  13. scanf("%d",&n);
  14. int sum=;
  15. for(int j=;j<n;j++){
  16. scanf("%d %d",&a,&b);
  17. sum+=a*b;
  18. }
  19. printf("%d\n",sum);
  20. }
  21.  
  22. return ;
  23. }

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

Problem Description
The Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.
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.
 
Input
The first line of input contains one integer N(N ≤ 30) which is the number of test cases.
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.

  1. + - + - + - + - + - + - +
    | q | r | a | b | u | v |
    + - + - + - + - + - + - +
    | s | t | c | d | w | x |
    + - + - + - + - + - + - +
    | e | f |
    + - + - +
    | g | h |
    + - + - +
    | i | j |
    + - + - +
    | k | l |
    + - + - +
    | m | n |
    + - + - +
    | o | p |
    + - + - +
Output
For each test case, output YES if can be restored in one step, otherwise output NO.
 
Sample Input
4 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 6 6 6 6 1 1 1 1 2 2 2 2 3 3 3 3 5 5 5 5 4 4 4 4 1 4 1 4 2 1 2 1 3 2 3 2 4 3 4 3 5 5 5 5 6 6 6 6 1 3 1 3 2 4 2 4 3 1 3 1 4 2 4 2 5 5 5 5 6 6 6 6
 
Sample Output
YES YES YES NO
 
Source
 
Recommend
jiangzijing2015   |   We have carefully selected several similar problems for you:  5994 5993 5992 5991 5990 
思路:在比赛的时候理解错意思了,以为是判断能不能复原模仿,而没看到只需要一步。
魔方是2*2的,有三种转的方法,上面顺时针转90度,逆时针转,前面顺时针,前面逆时针,左边顺时针(相当于右边顺时针),左边逆时针(相当于左边逆时针)
还有再加上不操作算是一种,总共七种类,模拟出来就行了。
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int a[][];
  7. int b[][];
  8.  
  9. bool judge(){
  10. int i=;
  11. for(int j=;j<=;j++){
  12. if(a[j][]==a[j][]&&a[j][]==a[j][]&&a[j][]==a[j][]){
  13. i++;
  14. }
  15. }
  16. if(i==){
  17. return true;
  18. }else{
  19. return false;
  20. }
  21. }
  22.  
  23. void opera1(){//前面顺时针
  24. int t1,t2;
  25. t1=a[][];
  26. t2=a[][];
  27.  
  28. a[][]=a[][];
  29. a[][]=a[][];
  30.  
  31. a[][]=a[][];
  32. a[][]=a[][];
  33.  
  34. a[][]=a[][];
  35. a[][]=a[][];
  36.  
  37. a[][]=t2;
  38. a[][]=t1;
  39. }
  40. void opera2(){//前面逆时针
  41. int t1,t2;
  42. t1=a[][];
  43. t2=a[][];
  44.  
  45. a[][]=a[][];
  46. a[][]=a[][];
  47.  
  48. a[][]=a[][];
  49. a[][]=a[][];
  50.  
  51. a[][]=a[][];
  52. a[][]=a[][];
  53.  
  54. a[][]=t2;
  55. a[][]=t1;
  56. }
  57. void opera3(){//上面顺时针
  58. int t1,t2;
  59. t1=a[][];
  60. t2=a[][];
  61.  
  62. a[][]=a[][];
  63. a[][]=a[][];
  64.  
  65. a[][]=a[][];
  66. a[][]=a[][];
  67.  
  68. a[][]=a[][];
  69. a[][]=a[][];
  70.  
  71. a[][]=t1;
  72. a[][]=t2;
  73. }
  74. void opera4(){//上面逆时针
  75. int t1,t2;
  76. t1=a[][];
  77. t2=a[][];
  78.  
  79. a[][]=a[][];
  80. a[][]=a[][];
  81.  
  82. a[][]=a[][];
  83. a[][]=a[][];
  84.  
  85. a[][]=a[][];
  86. a[][]=a[][];
  87.  
  88. a[][]=t2;
  89. a[][]=t1;
  90. }
  91. void opera5(){//左边顺指针
  92. int t1,t2;
  93. t1=a[][];
  94. t2=a[][];
  95.  
  96. a[][]=a[][];
  97. a[][]=a[][];
  98.  
  99. a[][]=a[][];
  100. a[][]=a[][];
  101.  
  102. a[][]=a[][];
  103. a[][]=a[][];
  104.  
  105. a[][]=t1;
  106. a[][]=t2;
  107. }
  108. void opera6(){//左边逆时针
  109. int t1,t2;
  110. t1=a[][];
  111. t2=a[][];
  112.  
  113. a[][]=a[][];
  114. a[][]=a[][];
  115.  
  116. a[][]=a[][];
  117. a[][]=a[][];
  118.  
  119. a[][]=a[][];
  120. a[][]=a[][];
  121.  
  122. a[][]=t1;
  123. a[][]=t2;
  124. }
  125. int main()
  126. {
  127. int n;
  128. scanf("%d",&n);
  129. while(n--){
  130. for(int i=;i<=;i++){
  131. for(int j=;j<=;j++){
  132. scanf("%d",&a[i][j]);
  133. b[i][j]=a[i][j];
  134. }
  135. }
  136. if(judge()){
  137. printf("YES\n");
  138. continue;
  139. }
  140. opera1();
  141. if(judge()){
  142. printf("YES\n");
  143. continue;
  144. }
  145. for(int i=;i<=;i++){
  146. for(int j=;j<=;j++){
  147. a[i][j]=b[i][j];
  148. }
  149. }
  150. opera2();
  151. if(judge()){
  152. printf("YES\n");
  153. continue;
  154. }
  155. for(int i=;i<=;i++){
  156. for(int j=;j<=;j++){
  157. a[i][j]=b[i][j];
  158. }
  159. }
  160. opera3();
  161. if(judge()){
  162. printf("YES\n");
  163. continue;
  164. }
  165. for(int i=;i<=;i++){
  166. for(int j=;j<=;j++){
  167. a[i][j]=b[i][j];
  168. }
  169. }
  170. opera4();
  171. if(judge()){
  172. printf("YES\n");
  173. continue;
  174. }
  175. for(int i=;i<=;i++){
  176. for(int j=;j<=;j++){
  177. a[i][j]=b[i][j];
  178. }
  179. }
  180. opera5();
  181. if(judge()){
  182. printf("YES\n");
  183. continue;
  184. }
  185. for(int i=;i<=;i++){
  186. for(int j=;j<=;j++){
  187. a[i][j]=b[i][j];
  188. }
  189. }
  190. opera6();
  191. if(judge()){
  192. printf("YES\n");
  193. continue;
  194. }
  195. for(int i=;i<=;i++){
  196. for(int j=;j<=;j++){
  197. a[i][j]=b[i][j];
  198. }
  199. }
  200. printf("NO\n");
  201. }
  202. return ;
  203. }

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

Problem Description
Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L.
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.
 
Input
The first line of input contains an integer N which is the number of test cases. Each of the N lines contains two float-numbers L and d respectively with at most 5 decimal places behind the decimal point where 1 ≤ d, L ≤ 150.
 
Output
For each test case, output the expected number of times rounded to 6 decimal places behind the decimal point in a line.
 
Sample Input
6
1.0 1.0
2.0 1.0
4.0 1.0
8.0 1.0
16.0 1.0
7.00 3.00
 
Sample Output
0.000000
1.693147
2.386294
3.079442
3.772589
1.847298
 
Source
 
Recommend
jiangzijing2015   |   We have carefully selected several similar problems for you:  5994 5993 5992 5991 5990 
思路:说实话比赛的时候根本不知道怎么做出来的。
好久之后才队友想起来,输出了一下log2,突然发现了规律。
赛后看别的队,一看0.693147就知道log2了,这就是做题多了有经验了啊。
但当时说的题解好像是求微积分,还是求导呢,把公式推导出来的。。。
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n;
  10. double a,b;
  11. scanf("%d",&n);
  12. while(n--){
  13. scanf("%lf%lf",&a,&b);
  14. if(a<=b){
  15. printf("0.000000\n");
  16. continue;
  17. }
  18. printf("%.6lf\n",log(a)-log(b)+);
  19. }
  20. return ;
  21. }

2016ACM青岛区域赛题解的更多相关文章

  1. 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 ...

  2. 2016青岛区域赛.Coding Contest(费用流 + 概率计算转换为加法计算)

    Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  3. ACM/ICPC2016 青岛区域赛

    A(hdu5982).(模拟) 题意:输入n对数,将每对数相乘并相加 分析:模拟 B(hdu5983).(模拟) 题意:给你一个二阶魔方,问能否通过一次旋转使得给定魔方的每个面颜色相同 分析:模拟 C ...

  4. 2016ACM-ICPC Qingdao Online青岛网络赛题解

    TonyFang+Sps+我=5/12 滚了个大粗 2016年9月21日16:42:36 10题完工辣 01 题意:求形同的数中大于n的最小值 题解:预处理所有的(5194个),在这里面二分 #inc ...

  5. 2016 年 ACM/ICPC 青岛区域赛 Problem C Pocky

    昨晚乱入学弟的训练赛,想了一下这个题.推导的过程中,加深了对公理化的概率论理解.$\newcommand{\d}{\mathop{}\!\mathrm{d}}$ 解法一 考虑 $ d < L$ ...

  6. 2018 ACM-ICPC南京区域赛题解

    解题过程 开场开A,A题shl看错题意,被制止.然后开始手推A,此时byf看错E题题意,开始上机.推出A的规律后,shl看了E题,发现题意读错.写完A题,忘记判断N=0的情况,WA+1.过了A后,sh ...

  7. Tournament ZOJ - 4063 (青岛区域赛 F 打表)

    打表题.. 规律是找出来了 奈何优化不了 .... #include <iostream> #include <cstdio> #include <sstream> ...

  8. UVALive - 7740 Coding Contest 2016 青岛区域赛 (费用流)

    题意:每个点i有\(s_i\)个人和\(b_i\)份食物,每个人都要找到一份食物.现在有M条有向边,从点i到点j,容量为c,第一次走过不要紧,从第二次开始就要承担\(p(0<p<1)\)的 ...

  9. 第42届亚洲区域赛青岛站(2017icpc青岛)经验总结以及一些感想

    上一次写这种东西还是天梯赛,当时打完心里也是挺激动的,然后我们队也没有去参加省赛,但是过了一段时间我还是从那里面恢复了出来.因为我当时确实还是很菜的,当时连个暴力都不会,看着自己仅过的那些百度的题目确 ...

随机推荐

  1. maven-过滤不打入包的文件

    在使用maven打包时,有时有些测试文件,或者配置都希望打入到架包中 此时就需要使用将不用的文件过滤,maven有很方便的过滤插件.因工作时间,暂不讨论.本次讨论一个非常简单除暴的方法,通过配置ecl ...

  2. Linux下 JDK安装

    在linux下安装JDK步骤如下: 第一步:查看Linux自带的JDK是否已安装 (1)查看jdk: [root@web-server ~]# rpm -qa|grep jdk ← 查看jdk的信息或 ...

  3. hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images

    hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images, 本例子主要是使用HTML5 的File API,建立一個可存取到该file的url, 一个空的img标签,ID为img0,把 ...

  4. 在javascript中使用Json

    jSON是JavaScript面向对象语法的一个子集.由于JSON是JavaScript的一个子集,因此它可清晰的运用于此语言中. 文本生成json对象,必须在外面加一对括号. js 代码 var m ...

  5. 如何在mac本上安装android sdk 避免被墙

    众所周知的原因,google的很多网站在国内无法访问,苦逼了一堆天朝程序员,下是在mac本上折腾android 开发环境的过程: 一.先下载android sdk for mac 给二个靠谱的网址: ...

  6. STL的使用

    Vector:不定长数组 Vector是C++里的不定长数组,相比传统数组vector主要更灵活,便于节省空间,邻接表的实现等.而且它在STL中时间效率也很高效:几乎与数组不相上下. #include ...

  7. bzoj 4610 Ceiling Functi

    bzoj 4610 Ceiling Functi Description bzoj上的描述有问题 给出\(n\)个长度为\(k\)的数列,将每个数列构成一个二叉搜索树,问有多少颗形态不同的树. Inp ...

  8. BZOJ4698: Sdoi2008 Sandy的卡片

    差分,枚举一个串的所有后缀,暴力在所有其他串中kmp,复杂度$O(nm^2)$. #include<cstdio> const int N=1005; const int M=105; i ...

  9. 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 ...

  10. python发送邮件

    python发送邮件(无附件) ======================================================= #!/usr/bin/env python#coding ...