Codeforces Round #339 Div.2 A - Link/Cut Tree
第一次正式参加常规赛想想有些小激动的呢
然后第一题就被hack了 心痛 _(:зゝ∠)_
tle点在于越界 因此结束循环条件从乘变为除 done
//等等 这题没过总评 让我静静........
//改天再来改吧.......
#include <cstdio> int main()
{
long long l, r, k;
scanf("%I64d%I64d%I64d", &l, &r, &k);
if(k > r) puts("-1");
else{
long long i = ;
for(; r / i >= k; i *= k){
if(i >= l) printf("%I64d ", i);
}
printf("%I64d\n", i);
}
return ;
}
----------------------------------------------Updata----------------------------------------------------
k > r 时 如果l == 1 则要输出一个1
另外 如果过程中直接跳过这个循环 是要输出一个-1的
#include <cstdio>
int main()
{
long long l, r, k;
scanf("%I64d%I64d%I64d", &l, &r, &k);
if(k > r){
if(l > ) puts("-1");
else puts("");
}
else{
long long i = ;
for(; r / i >= k; i *= k){
if(i >= l) printf("%I64d ", i);
}
if(i >= l) printf("%I64d\n", i);
else puts("-1");
}
return ;
}
Codeforces Round #339 Div.2 A - Link/Cut Tree的更多相关文章
- Codeforces Round #339 (Div. 2) A. Link/Cut Tree 水题
A. Link/Cut Tree 题目连接: http://www.codeforces.com/contest/614/problem/A Description Programmer Rostis ...
- Codeforces Round #670 (Div. 2) C. Link Cut Centroids (dfs,树)
C. Link Cut Centroids Fishing Prince loves trees, and he especially loves trees with only one centro ...
- Codeforces Round #339 (Div.2)
A. Link/Cut Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- Codeforces Round #339 (Div. 2) A
Description Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which ...
- Codeforces Round #319 (Div. 1) B. Invariance of Tree 构造
B. Invariance of Tree Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/576/ ...
- Codeforces Round #339 (Div. 1) C. Necklace 构造题
C. Necklace 题目连接: http://www.codeforces.com/contest/613/problem/C Description Ivan wants to make a n ...
- Codeforces Round #339 (Div. 1) A. Peter and Snow Blower 计算几何
A. Peter and Snow Blower 题目连接: http://www.codeforces.com/contest/613/problem/A Description Peter got ...
- Codeforces Round #339 (Div. 2) B. Gena's Code 水题
B. Gena's Code 题目连接: http://www.codeforces.com/contest/614/problem/B Description It's the year 4527 ...
- Codeforces Round #339 (Div. 1) B. Skills 暴力 二分
B. Skills 题目连接: http://www.codeforces.com/contest/613/problem/B Description Lesha plays the recently ...
随机推荐
- 【转发】Linux系统下安装rz/sz命令及使用说明
对于经常使用Linux系统的人员来说,少不了将本地的文件上传到服务器或者从服务器上下载文件到本地,rz / sz命令很方便的帮我们实现了这个功能,但是很多Linux系统初始并没有这两个命令.今天,我们 ...
- Apache Jmeter(1)
Apache JMeter是Apache组织开发的基于Java的压力测试工具.用于对软件做压力测试,它最初被设计用于Web应用测试但后来扩展到其他测试领域. 它可以用于测试静态和动态资源例如静态文件. ...
- c# access插入null值
c# 插入access数据库 提示错误: Parameter @DeviceLocation has no default value. 参数@DeviceLocation 的有没有默认值. Stri ...
- goldengate 12c对teradata的支持
OGG12c在2014.4.24发布了对TD的最新支持版本,软件可在此下载:https://edelivery.oracle.com.新版本特性如下: 当前支持TD 14.1的捕获和交付,仍然基于Te ...
- MySQL表的增删改查和列的修改(二)
一.使用Like模糊查找搜索前缀为以“exam_”开头的表名 show tables like 'exam_%' ; 语句结束符号是:也是用\G来表示 二.MySQL表的CRUD 2.1 创建表: C ...
- Ajax返回类型JSON,XML
Ajax的三种返回类型 **一.TEXT *二.JSON 数据显示页面代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transiti ...
- 理解NSTextContainer
Apple的Doc对这个类的描述是这样的: The NSTextContainer class defines a region where text is laid out. An NSLayout ...
- Canopy使用教程 (2)
1.下载https://reputation.alienvault.com/reputation.data alienvault公司的IP信誉数据库文件到本地,手动或者wget 2.使用 read_c ...
- Ch2.Making Reconmmendation in PCI
做<Programing Collective Intelligence>中chapter 2.Making Recommendation的实例,有3个问题花了好长时间: 1. 遇到报错& ...
- RFID Hacking③:使用ProxMark3嗅探银行闪付卡信息
0×00 前言 RFID是Radio Frequency Identification的缩写,术语为射频识别,俗称电子标签.按照工作频率的不同,RFID标签可以分为低频(LF).高频(HF).超高频( ...