URAL 1777 D - Anindilyakwa 暴力
D - Anindilyakwa
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/D
Description
Input
The only input line contains space-separated pairwise distinct integers x1, x2 and x3 (1 ≤ x1, x2, x3 ≤ 10 18) , which are the numbers of stones in piles that were lying on the meadow at the moment professor Butterworth asked the first aborigine.
Output
Output the number of aborigines that will have to answer a stupid question by professor.
Sample Input
11 5 9
Sample Output
3
HINT
题意
一开始有3堆石头,然后会产生差值最小的那堆石头,然后问你得多少次之后,才会产生同样个数的石头
题解:
数据范围很小,直接暴力就好了
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 125000
#define mod 10007
#define eps 1e-9
int Num;
//const int inf=0x7fffffff; //нчоч╢С
const int inf=0x3f3f3f3f;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** ll a[maxn];
int main()
{
for(int i=;i<;i++)
cin>>a[i];
int tot=;
int ans=;
while()
{
sort(a,a+tot);
ll dd=-;
for(int i=;i<tot-;i++)
{
if(dd==-)
dd=a[i+]-a[i];
else
dd=min(dd,a[i+]-a[i]);
}
if(dd==)
{
cout<<ans<<endl;
return ;
}
ans++;
a[tot++]=dd;
}
}
URAL 1777 D - Anindilyakwa 暴力的更多相关文章
- URAL 1957 Wrong Answer 暴力
Wrong Answer 思路: 1.先枚举4的全排列,即球赛的所有可能结果,一共4!=24种情况 2.对于每种情况,DFS 未确定的比赛 的结果,判断这种情况是否可达. 剪枝: 1.对于每种全排列, ...
- URAL 1010 Discrete Function【简单暴力】
链接: http://acm.timus.ru/problem.aspx?space=1&num=1010 http://acm.hust.edu.cn/vjudge/contest/vie ...
- Timus 1777. Anindilyakwa 奇怪的问题计数
The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: "I ...
- ural 1104,暴力取模
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1104 题目大意:输入一个字符串(数字与大写字母组成),输出n,n满足此字符串为n进制时, ...
- URAL 2066 Simple Expression (水题,暴力)
题意:给定三个数,让你放上+-*三种符号,使得他们的值最小. 析:没什么好说的,全算一下就好.肯定用不到加,因为是非负数. 代码如下: #pragma comment(linker, "/S ...
- Ural 1780 Gray Code 乱搞暴力
原题链接:http://acm.timus.ru/problem.aspx?space=1&num=1780 1780. Gray Code Time limit: 0.5 secondMem ...
- Ural 2064:Caterpillars(思维暴力)
http://acm.timus.ru/problem.aspx?space=1&num=2064 题意:有n只虫子在爬树,每个虫子往上爬ti距离后会往下掉落ti距离,每爬一个单位距离耗费一个 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2062 Ambitious Experiment
2062. Ambitious Experiment Time limit: 3.0 secondMemory limit: 128 MB During several decades, scient ...
随机推荐
- TCP/IP详解学习笔记(4)-ICMP协议,ping和Traceroute
1.IMCP协议介绍 前面讲到了,IP协议并不是一个可靠的协议,它不保证数据被送达,那么,自然的,保证数据送达的工作应该由其他的模块来完成.其中一个重要的模块就是ICMP(网络控制报文)协议. 当传送 ...
- Free Pascal的IDE界面乱码解决方法
右击[Free Pascal]快捷图标,选[属性] [属性]窗口中,选择[选项]页,下拉[当前代码页(C)],选择[437 (美国)] 按[确定] 注意:[开始]菜单和桌面中的快捷图标都得设置.
- java web 学习五(servlet开发1)
一.Servlet简介 Servlet是sun公司提供的一门用于开发动态web资源的技术. Sun公司在其API中提供了一个servlet接口,用户若想用发一个动态web资源(即开发一个Java程序向 ...
- lightoj 1023
题意:让你输出前N个大写字母的前K个排列,按字典序,很水,直接dfs. #include<cstdio> #include<string> #include<cstrin ...
- Tableau学习笔记之二
2张图片解析下Tableau 9.0界面的功能 1.数据加载界面: 2.数据分析界面:
- MFC字体与文本输出
字体 成员函数 1.CFont( ); 构造一个CFont对象.此对象在使用之前应该先使用CreateFont.CreateFontIndirect.CreatePointFont或CreatePoi ...
- [转]使用CSS3 Grid布局实现内容优先
使用CSS3 Grid布局实现内容优先 http://www.w3cplus.com/css3/css3-grid-layout-module.html 本文由大漠根据Rachel Andrew的& ...
- PageRank与社交网络模型评估
SNS社交网络在近几年流行起来,并呈现出火爆的增长趋势.在仿制国外Facebook.twitter等成功先例的基础上,国内的人人网.新浪微博等一系列社交网络正风生水起. 这些社交网站表面上看起来十分普 ...
- CSS Sprite的优缺点分析
目前大多数的开发人员对这个技术都有相当地掌握,也有很多关于它的教程和文章.几乎所有的文章中都宣称设计师和开发人员都应该使用 CSS sprite 来减少 HTTP 请求数,并且节省一些流量.这个技术被 ...
- [Hive - LanguageManual] Create/Drop/Alter -View、 Index 、 Function
Create/Drop/Alter View Create View Drop View Alter View Properties Alter View As Select Version info ...