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 ...
随机推荐
- 日期时间选择器bootstrap-datetimepicker表单组件
Bootstrap受到很多人的喜欢,它不仅拥有一套完整漂亮的UI,而且爱好者们为其开发扩展了很多有用的插件和主题!让其拥有无限可能! 今天为开发者推荐一款强大,易用的时间日历插件——bootstrap ...
- openfire build
1. build path: a) source folder:包括openfire和各插件的代码. b) libraries:build/lib下jar包和插件下jar包,jdk/lib/tools ...
- [acm]HDOJ 1200 To and Fro
题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...
- BZOJ2726:任务安排(DP+斜率优化+二分)
机器上有N个需要处理的任务,它们构成了一个序列.这些任务被标号为1到N,因此序列的排列为1,2,3...N.这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务 ...
- 每天一个linux命令(1):man命令
版权声明 更新:2017-04-19博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下命令man. 2 ...
- C# 获取Console的输入和输出 数据 (异步)
using System ; using System .Diagnostics; using System .IO; class Program { static void Main() ...
- XmlSerialize error: There was an error generating the XML document.
今天遇到一个很火的问题, 一个c#的class 序列化成xml后抛出异常, 信息为: XmlSerialize error: There was an error generating the XML ...
- JSP的优势 和劣势 与php的比较
一 jsp的 优势 与劣势 由于JSP页面的内置脚本语言是基于Java编程语言的,而且所有的JSP页面都被编译成为Java Servlet,JSP页面就具有Java技术的所有好处,包括健壮的存储管理和 ...
- POJ3660(foyld闭包问题)
Cow Contest Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8794 Accepted: 4948 Descr ...
- POJ-3617
Best Cow Line Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 25616 Accepted: 6984 De ...