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. 浅谈C#中常见的委托

    一提到委托,浮现在我们脑海中的大概是听的最多的就是类似C++的函数指针吧,呵呵,至少我的第一个反应是这样的. 关于委托的定义和使用,已经有诸多的人讲解过,并且讲解细致入微,尤其是张子阳的那一篇.我就不 ...

  2. NameNode备份策略以及恢复方法

    一.dits和fsimage      首先要提到两个文件edits和fsimage,下面来说说他们是做什么的. 集群中的名称节点(NameNode)会把文件系统的变化以追加保存到日志文件edits中 ...

  3. 使用C语言获取字符串或文件的MD5值

    libmd5地址:https://sourceforge.net/projects/libmd5-rfc/ MD5Demo1.c #include <stdio.h> #include & ...

  4. QT下QThread学习(二)

    学习QThread主要是为了仿照VC下的FTP服务器写个QT版本.不多说,上图. FTP服务器的软件结构在上面的分析中就已经解释了,今天要解决的就是让每一个客户端的处理过程都可以按一个线程来单独跑.先 ...

  5. MySQL安装、安装时未提示输入密码、如何修改密码小结

    http://blog.csdn.net/fr555wlj/article/details/54971412

  6. 计算一个大数n的阶乘的位数宽度(十进制)(log i累加法 )

    输入: 每行输入1个正整数n, (0<n<1000 000) 输出: 对于每个n,输出n!的(十进制)位数. 分析: 这道题采用蛮力法.根据定义,直接求解! 所谓n!的十进制位数,就是 l ...

  7. Javascript版五子棋

    Javascript版五子棋,无禁手.欢迎提出算法的改进意见.2. [代码]HTML     <!DOCTYPE html><html>    <head>    ...

  8. Oracle:datafile删除后,重启server报ORA-01110

    模拟实验: 创建一个表空间后,直接把数据文件删除了:然后重启server. 1. create tablespace w56 datafile '/u01/app/oracle/product/10. ...

  9. Android gif 录屏

    /********************************************************************************** * Android gif 录屏 ...

  10. bzoj2748音量调节——背包

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2748 怎么会有这样的省选题... 代码如下: #include<iostream> ...