Codeforces Round 56-A. Dice Rolling(思维题)
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Mishka got a six-faced dice. It has integer numbers from 22 to 77 written on its faces (all numbers on faces are different, so this is an almostusual dice).
Mishka wants to get exactly xx points by rolling his dice. The number of points is just a sum of numbers written at the topmost face of the dice for all the rolls Mishka makes.
Mishka doesn't really care about the number of rolls, so he just wants to know any number of rolls he can make to be able to get exactly xxpoints for them. Mishka is very lucky, so if the probability to get xx points with chosen number of rolls is non-zero, he will be able to roll the dice in such a way. Your task is to print this number. It is guaranteed that at least one answer exists.
Mishka is also very curious about different number of points to score so you have to answer tt independent queries.
Input
The first line of the input contains one integer tt (1≤t≤1001≤t≤100) — the number of queries.
Each of the next tt lines contains one integer each. The ii-th line contains one integer xixi (2≤xi≤1002≤xi≤100) — the number of points Mishka wants to get.
Output
Print tt lines. In the ii-th line print the answer to the ii-th query (i.e. any number of rolls Mishka can make to be able to get exactly xixi points for them). It is guaranteed that at least one answer exists.
Example
input
Copy
4
2
13
37
100
output
Copy
1
3
8
27
Note
In the first query Mishka can roll a dice once and get 22 points.
In the second query Mishka can roll a dice 33 times and get points 55, 55 and 33 (for example).
In the third query Mishka can roll a dice 88 times and get 55 points 77 times and 22 points with the remaining roll.
In the fourth query Mishka can roll a dice 2727 times and get 22 points 1111 times, 33 points 66 times and 66 points 1010 times.
每次都是两道,唉,何时才能提高啊
题解:把每次都看成2即可,感觉有点水
代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
int n;
cin>>n;
int k;
for(int t=0;t<n;t++)
{
cin>>k;
cout<<k/2<<endl;
}
return 0;
}
Codeforces Round 56-A. Dice Rolling(思维题)的更多相关文章
- Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...
- Codeforces Round #609 (Div. 2)前五题题解
Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Eq ...
- Educational Codeforces Round 56 (Rated for Div. 2)
涨rating啦.. 不过话说为什么有这么多数据结构题啊,难道是中国人出的? A - Dice Rolling 傻逼题,可以用一个三加一堆二或者用一堆二,那就直接.. #include<cstd ...
- Educational Codeforces Round 56 (Rated for Div. 2) ABCD
题目链接:https://codeforces.com/contest/1093 A. Dice Rolling 题意: 有一个号数为2-7的骰子,现在有一个人他想扔到几就能扔到几,现在问需要扔多少次 ...
- Educational Codeforces Round 56 Solution
A. Dice Rolling 签到. #include <bits/stdc++.h> using namespace std; int t, n; int main() { scanf ...
- Educational Codeforces Round 40 C. Matrix Walk( 思维)
Educational Codeforces Round 40 (Rated for Div. 2) C. Matrix Walk time limit per test 1 second memor ...
- Educational Codeforces Round 56 (Rated for Div. 2) F - Vasya and Array dp好题
F - Vasya and Array dp[ i ][ j ] 表示用了前 i 个数字并且最后一个数字是 j 的方案数. dp[ i ][ j ] = sumdp [i - 1 ][ j ], 这样 ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
- Educational Codeforces Round 7 A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...
随机推荐
- BZOJ 1601 [Usaco2008 Oct]灌水:最小生成树
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1601 题意: Farmer John已经决定把水灌到他的n(1<=n<=300 ...
- 使用gdb调试c/c++代码
转自 http://blog.csdn.net/haoel/article/details/2879 GDB概述———— GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较 ...
- 使用 DNSPOD API 实现域名动态解析
0. 简单概述在家里放一个 NAS 服务器,但是宽带的 IP 地址经常改变,一般路由器自带的花生壳域名解析可以解决,如果路由器没有类似功能或者想使用自己的域名,可以尝试使用 DNSPOD API 来实 ...
- cifs挂载远程文件出现 No such device or address错误
1. 参考 https://www.raspberrypi.org/forums/viewtopic.php?t=82199 找了两天看到这个文章才解决了问题. 我是之前同事在windows上挂载成功 ...
- Qt之log数据展示模块简要实现
Log模块主要用于实时测井数据的显示和测后曲线数据的预览和打印,为更好的展示对Qt中相关知识点的应用,特以Log模块为例对其进行简要实现. 内容导图: 一.功能需求 1.界面效果图 Log模块实现曲线 ...
- 京东SDK模板卡盘效果实现代码
最近在做京东模板,因为是最新平台,好多功能都需要摸索,俺技术一般,摸索出一个简易的卡盘功能 ——————使用的是分类推荐模块哦! 本着共享的精神,俺将代码放到这儿了,各人请自便.(代码还不够完善, ...
- 实现PIX需要参考的标准资料
•初步了解PIX V2和V3:"IHE_ITI_TF_Rev8-0_Vol1_FT_2011-08-19"中第5章和第23章 •了解PIX V2相关事务: "IHE_IT ...
- ubuntu下 修改主机名
sudo gedit /etc/hostname 写入: sudo gedit /etc/hosts
- 机器学习、图像识别方面 书籍推荐 via zhihu
机器学习.图像识别方面 书籍推荐 作者:小涛 链接:https://www.zhihu.com/question/20523667/answer/97384340 来源:知乎 著作权归作者所有.商业转 ...
- textarea的style="resize:none;"
<textarea class="form-control" id="gryj" rows="3" maxlength="3 ...