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

然后第一题就被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. 创建plist文件

    可以先在工程中直接新建一个plist文件,往里面写入自己需要的数据.但是这里的plist文件我们无法修改,是只读的,我们可以将这个plist文件复制一份到沙盒中,然后对沙盒中的文件进行操作.具体代码如 ...

  2. MATLAB图像处理函数汇总(一)

    1.applylut功能: 在二进制图像中利用lookup表进行边沿操作.语法:A = applylut(BW,lut)举例lut = makelut('sum(x(:)) == 4',2);BW1 ...

  3. Controller方法的返回值

    方法的返回值1.ModelAndView这个就不多说,这是最基础的,前面定义一个ModelAndView,中途使用addObject方法添加属性,再返回.视图解析器会自动扫描到的.2.String这个 ...

  4. 迭代器(Iterator)模式

    转自:http://blog.csdn.net/lilu_leo/article/details/7609496 概述      迭代器(Iterator)模式,又叫做游标(Cursor)模式.GOF ...

  5. SharePoint安全 - SharePoint网站常用页面URL索引

    博客地址 http://blog.csdn.net/foxdave 一. 主要网站内容 首页 /default.aspx /Pages/default.aspx 网站设置 /_layouts/sett ...

  6. NSURLSession的使用

    虽然在iOS7引入NSURLSession时,就知道NSURLConnection会最终被苹果放弃,但人总是喜欢做熟悉的事情,在NSURLConnection还可以使用时,就懒得学习这新玩意了,而且本 ...

  7. Unichar, char, wchar_t

    之前总结了一些关于字符表示,以及字符串的知识. 现在在看看一些关于编译器支持的知识. L"" Prefix 几乎所有的编译器都支持L“” prefix,一个字符串如果带有L“”pr ...

  8. OD调试篇5--如何应对OD使用中的一些问题

    打开小甲鱼给的进行恶搞过的程序,会发现一些问题 发现程序直接暂停,或者加载进来有问题. 那机智的我 通过对上一个没有恶搞过的exe可执行文件的PE头进行了比较 会发现其中的猫腻 那么我们去正常的修改一 ...

  9. Android屏幕底部弹出DialogFragment(3)

     Android屏幕底部弹出DialogFragment(3) 附录文章1,2的DialogFragment是常规的DialogFragment,但是现在的一些Android开发中,往往需要从底部 ...

  10. this的指向及应用

    this的指向: //this 指的是调用 当前方法 (函数) 的那个对象 function fn1(){ this; } //fn1(); this => window //obj.oncli ...