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. mac classpath设置

    I've been searching for the answer daylong, and finally had the problems solved. I am going to write ...

  2. 一个动态库连续注册的windows脚本regsvr32

    cmd ->for %1 in (%windir%\system32\*.dll) do regsvr32.exe /s %1

  3. hadoop mapred和mapreduce包

    mapred包是老的1.0的map reduce api mapreduce包是新的2.0的map reduce api

  4. 用Java编写的http下载工具类,包含下载进度回调

    HttpDownloader.java package com.buyishi; import java.io.FileOutputStream; import java.io.IOException ...

  5. OpenMAX IL介绍与其体系

    1  OpenMAX IL介绍与其体系 这一部分的文档描写叙述 OpenMAX IL的特性与体系. 1.1  OpenMAX IL 简述 OpenMAX IL 软件接口层定义了一套API.用于訪问系统 ...

  6. ref 与 $refs 如何关联

    先问大家一个简单的问题: 还有人记得 jquery 里面的 data 方法是如何让 DOM 节点绑定对应的数据对象的吗 有时候我们做节点关联设计的思路其实有一点类似,但是在 vue 里面多了很多概念, ...

  7. POJ3104 Drying —— 二分

    题目链接:http://poj.org/problem?id=3104 Drying Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...

  8. POJ1077 Eight —— A*算法

    主页面:http://www.cnblogs.com/DOLFAMINGO/p/7538588.html 关于A*算法:g(n)表示从起点到任意节点n的路径花费,h(n)表示从节点n到目标节点路径花费 ...

  9. html5--6-57 阶段练习6-折叠导航栏

    html5--6-57 阶段练习6-折叠导航栏 实例 @charset="UTF-8"; *{ ; ; } h3+div{ ; overflow: hidden; transiti ...

  10. c++11实现DLL帮助类

    用过DLL的人都会发现,在C++中调用dll中的函数有点繁琐,调用过程如下:在加载dll后还要定义一个对应的函数指针类型,接着调用GetProcAddress获取函数地址,再转成函数指针,最后调用函数 ...