第一次正式参加常规赛想想有些小激动的呢

然后第一题就被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的更多相关文章

  1. Codeforces Round #339 (Div. 2) A. Link/Cut Tree 水题

    A. Link/Cut Tree 题目连接: http://www.codeforces.com/contest/614/problem/A Description Programmer Rostis ...

  2. 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 ...

  3. Codeforces Round #339 (Div.2)

    A. Link/Cut Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  4. Codeforces Round #339 (Div. 2) A

    Description Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which ...

  5. 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/ ...

  6. Codeforces Round #339 (Div. 1) C. Necklace 构造题

    C. Necklace 题目连接: http://www.codeforces.com/contest/613/problem/C Description Ivan wants to make a n ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #339 (Div. 1) B. Skills 暴力 二分

    B. Skills 题目连接: http://www.codeforces.com/contest/613/problem/B Description Lesha plays the recently ...

随机推荐

  1. 详解x86、IA-32、IA-64等CPU系列

    x86架构起源于Intel公司在1978年推出的8086处理器.8086在1981年为IBM PC所选用,之后x86便成为了个人电脑的标准平台,成为历上最成功的CPU架构.8086是一款16位CPU, ...

  2. 解决json跨域时错误:SyntaxError: invalid label

    将数据做以下返回: $callback = $_GET['callback']; echo $callback.'('.json_encode(array('html'=>$html)).')' ...

  3. python建立pip.ini

    pip 是python的包管理器工具,类似linux的apt-get.yum包管理器,主要是用来进行安装python库, pip默认从官方源pypi.python.org下载数据,国内速度相对比较慢, ...

  4. JAVA调用系统命令或可执行程序--返回一个Runtime运行时对象,然后启动另外一个进程来执行命令

    通过 java.lang.Runtime 类可以方便的调用操作系统命令,或者一个可执行程序,下面的小例子我在windows和linux分别测试过,都通过.基本原理是,首先通过 Runtime.getR ...

  5. TCP同步传送数据示例(简洁、清楚)

    转自:http://www.2cto.com/kf/201206/134841.html 本例子写了个简单的TCP数据传送功能.没有使用BinaryWriter,BinaryReader,而是使用Ne ...

  6. Ubuntu 14.10 下grep命令详解

    简介 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它 ...

  7. (转)innerHTML、innerText和outerHTML、outerText的区别

    原文:http://walsh.iteye.com/blog/261966 innerHTML.innerText和outerHTML.outerText的区别          博客分类: CSS/ ...

  8. (转)MyEclipse设置注释格式

    原文:http://xinghaifeng2006.iteye.com/blog/1243565 MyEclipse设置注释格式(转载)          博客分类: Java基础知识   Windo ...

  9. Virtual Friend Function

    一般而言,友元作为一种紧耦合的设计,被视作类的一部分.一个经典的应用就是关于类的序列化和反序列化. class A { friend ostream& operator<<(ost ...

  10. swift SDWebImage使用

    Web image(网络图像) 该库提供了一个支持来自Web的远程图像的UIImageView类别它提供了: 添加网络图像和缓存管理到Cocoa Touch framework的UIImageView ...