A.Relic Discovery

题目描述

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 are Ai 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. 

输入描述:

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 A_i and B_i as described above. All numbers are positive integers and less than 101.

输出描述:

For each case, output one integer, the total expenditure in million dollars.

输入例子:
1
2
1 2
3 4
输出例子:
14

-->

示例1

输入

1
2
1 2
3 4

输出

14
解题思路:简单水过!
AC代码:
 #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int t,n,a,b,sum;
int main(){
while(cin>>t){
while(t--){
cin>>n;sum=;
while(n--){
cin>>a>>b;
sum+=a*b;
}
cout<<sum<<endl;
}
}
return ;
}

B.Pocket Cube

题目描述

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. 

输入描述:

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.

 

输出描述:

For each test case, output YES if can be restored in one step, otherwise output NO.

输入例子:
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
输出例子:
YES
YES
YES
NO

-->

示例1

输入

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

输出

YES
YES
YES
NO
解题思路:简单模拟,看转一步是否到位,即每一面的数字相同即可。
AC代码:
 #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,o[],t[];bool flag;
bool judge(){
for(int i=;i<=;i+=)
for(int j=i+;j<i+;++j)
if(t[j]!=t[j-])return false;
return true;
}
void restore(){
for(int i=;i<=;++i)t[i]=o[i];
}
int main(){
while(cin>>n){
while(n--){
for(int i=;i<=;++i)cin>>o[i],t[i]=o[i];
flag=judge();
if(!flag){//左上旋
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
if(!flag){//左下旋
restore();
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
}
}
if(!flag){//上左旋
restore();
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
if(!flag){//上右旋
restore();
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
}
}
if(!flag){//正左旋
restore();
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
if(!flag){//正右旋
restore();
t[]=t[],t[]=t[],t[]=t[],t[]=t[];
t[]=t[],t[]=t[],t[]=o[],t[]=o[];
flag=judge();
}
}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
return ;
}

C.Pocky

题目描述

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. 

输入描述:

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.

输出描述:

For each test case, output the expected number of times rounded to 6 decimal places behind the decimal point in a line.

输入例子:
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
输出例子:
0.000000
1.693147
2.386294
3.079442
3.772589
1.847298

-->

示例1

输入

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

输出

0.000000
1.693147
2.386294
3.079442
3.772589
1.847298
解题思路:因为ln(2)≈0.693147,因此大胆验证一下数据,发现当l>d时,f=ln(l/d)+1,否则f=0。
AC代码:
 #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int t;double l,d;
int main(){
while(cin>>t){
while(t--){
cin>>l>>d;
if(l<=d)cout<<"0.000000"<<endl;
else cout<<setiosflags(ios::fixed)<<setprecision()<<(1.0+log(l/d))<<endl;
}
}
return ;
}

牛客国庆集训派对Day_7的更多相关文章

  1. 牛客国庆集训派对Day6 A Birthday 费用流

    牛客国庆集训派对Day6 A Birthday:https://www.nowcoder.com/acm/contest/206/A 题意: 恬恬的生日临近了.宇扬给她准备了一个蛋糕. 正如往常一样, ...

  2. 2019牛客国庆集训派对day5

    2019牛客国庆集训派对day5 I.Strange Prime 题意 \(P=1e10+19\),求\(\sum x[i] mod P = 0\)的方案数,其中\(0 \leq x[i] < ...

  3. 牛客国庆集训派对Day1 L-New Game!(最短路)

    链接:https://www.nowcoder.com/acm/contest/201/L 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 1048576K,其他语言20 ...

  4. 牛客国庆集训派对Day4 J-寻找复读机

    链接:https://www.nowcoder.com/acm/contest/204/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 1048576K,其他语言20 ...

  5. 牛客国庆集训派对Day4 I-连通块计数(思维,组合数学)

    链接:https://www.nowcoder.com/acm/contest/204/I 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 1048576K,其他语言20 ...

  6. 牛客国庆集训派对Day1-C:Utawarerumono(数学)

    链接:https://www.nowcoder.com/acm/contest/201/C 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 1048576K,其他语言20 ...

  7. 牛客国庆集训派对Day2 Solution

    A    矩阵乘法 思路: 1° 牛客机器太快了,暴力能过. #include <bits/stdc++.h> using namespace std; #define N 5000 in ...

  8. 2019 牛客国庆集训派对day1-C Distinct Substrings(exkmp+概率)

    链接:https://ac.nowcoder.com/acm/contest/1099/C来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536 ...

  9. 2018 牛客国庆集训派对Day4 - H 树链博弈

    链接:https://ac.nowcoder.com/acm/contest/204/H来源:牛客网 题目描述 给定一棵 n 个点的树,其中 1 号结点是根,每个结点要么是黑色要么是白色 现在小 Bo ...

随机推荐

  1. VC断点失败的原因之中的一个

    VC断点失败的原因之中的一个 flyfish 2014-10-23 情景 再debug状态下仅仅有一个cpp文件.命中不了断点. 提示 能够 同意源码与原始版本号不同 不採用,防止出现未知的隐患 问题 ...

  2. REST – PUT vs POST

    REST – PUT vs POST – REST API Tutorial https://restfulapi.net/rest-put-vs-post/ REST – PUT vs POST I ...

  3. 集群环境搭建-SSH免密码登陆(二)

    1.打开sshd配置 命令: vi /etc/ssh/sshd_config 找到以下内容,并去掉注释符”#“ RSAAuthentication yes PubkeyAuthentication y ...

  4. Java类加载器(ClassLoader)

    类加载的机制的层次结构 每个编写的”.java”拓展名类文件都存储着需要执行的程序逻辑,这些”.java”文件经过Java编译器编译成拓展名为”.class”的文件,”.class”文件中保存着Jav ...

  5. ADB结构及代码分析【转】

    本文转载自:http://blog.csdn.net/happylifer/article/details/7682563 最近因为需要,看了下adb的源代码,感觉这个作者很牛,设计的很好,于是稍微做 ...

  6. YTU 2866: 结构体---点坐标结构体

    2866: 结构体---点坐标结构体 时间限制: 1 Sec  内存限制: 128 MB 提交: 499  解决: 344 题目描述 定义一个表示点坐标的结构体,输入两个点的坐标,输出这两个点中点的坐 ...

  7. DEDE自定义表单显示提交时间|添加提交时间,获取ip的方法

    前提是后台自定义表单字段一定要有  “时间”,这里的acca_time <div class="tit">*咨询内容:</div> <div clas ...

  8. js中获取时间new date()的用法 获取时间:

    获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getF ...

  9. 网络编程、三要素、Socket通信、UDP传输、TCP协议、服务端(二十五)

    1.网络编程概述 * A:计算机网络 * 是指将地理位置不同的具有独立功能的多台计算机及其外部设备,通过通信线路连接起来,在网络操作系统,网络管理软件及网络通信协议的管理和协调下,实现资源共享和信息传 ...

  10. 如何去掉idea里mybatis的.xml文件 sql 语句背景色

    点击有背景的地方 Alt+Enter选择 un-inject Language/refence 即可去掉