2679:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1679

2952:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1951

ZOJ:2679先来~

水题大意:(题目大意:我什么时候改名了哇T T)

给你一个5位数的中间三个字母,还有一个数N让你求能被N整除的最大的五位数。

思路:

直接暴力枚举。。。。

#include<cstdio>
int num[6];
int main()
{
int T,n;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
scanf("%d%d%d",&num[2],&num[3],&num[4]);
bool ok=false;
for(int x=9;x>=1;x--)
{
num[1]=x;
for(int k=9;k>=0;k--)
{
num[5]=k;
int t=1,ans=0;
for(int i=5;i>=1;i--,t*=10)
ans=ans+ num[i]*t;
if(ans % n ==0)
{
ok=true;
printf("%d %d %d\n",x,k,ans/n);
goto end;
}
}
}
end:;
if(!ok)
printf("0\n"); }
return 0;
}

ZOJ : 2952

水题大意:

找出所有小于2^31能被表示为n ^m的数。

思路:

传说中的打表。

用long long 防乘法的时候直接越界了。

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL N=2147483648;
const int MAXN=50000;
int len=0;
LL ans[MAXN];
int main()
{ for(LL i=2;i*i<=N;i++)
{
LL temp=i;
while(true)
{
temp=temp*i;
if(temp>=N)
break;
ans[len++]=temp;
}
}
sort(ans,ans+len);
printf("%d\n",ans[0]);
for(int i=1;i<len;i++)
if(ans[i]!=ans[i-1])
printf("%lld\n",ans[i]);
return 0;
}

ZOJ 2679 Old Bill ||ZOJ 2952 Find All M^N Please 两题水题的更多相关文章

  1. ZOJ 2679 Old Bill(数学)

    主题链接:problemCode=2679" target="_blank">http://acm.zju.edu.cn/onlinejudge/showProbl ...

  2. zoj 2679 Old Bill

    Old Bill Time Limit: 2 Seconds      Memory Limit: 65536 KB Among grandfather��s papers a bill was fo ...

  3. ZOJ 2819 Average Score 牡丹江现场赛A题 水题/签到题

    ZOJ 2819 Average Score Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge ...

  4. 水题 ZOJ 3875 Lunch Time

    题目传送门 /* 水题:找排序找中间的价格,若有两个,选价格大的: 写的是有点搓:) */ #include <cstdio> #include <iostream> #inc ...

  5. 水题 ZOJ 3876 May Day Holiday

    题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...

  6. 水题 ZOJ 3880 Demacia of the Ancients

    题目传送门 /* 水题:) */ #include <cstdio> #include <iostream> #include <algorithm> #inclu ...

  7. [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]

    The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...

  8. [ACM_水题] ZOJ 3714 [Java Beans 环中连续m个数最大值]

    There are N little kids sitting in a circle, each of them are carrying some java beans in their hand ...

  9. [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]

    MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...

随机推荐

  1. 整理一些PHP开发安全问题

    整理一些PHP开发安全问题 php给了开发人员极大的灵活性,可是这也为安全问题带来了潜在的隐患.最近须要总结一下以往的问题,在这里借翻译一篇文章同一时候加上自己开发的一些感触总结一下. 简单介绍 当开 ...

  2. js --- for in 和 for of

    前言:for of是ES6新增的循环方法.前面已经说到了 [JavaScript]for.forEach .for in.each循环详解.那for of又是怎么使用的? 一.使用例子 使用例子(一) ...

  3. jQuery对象与js对象转换

    前言 jq方法和js的方法属性是不能互相使用的,所以有时候就需要转一下,下面就介绍下方法. js对象转化为jQuery对象 var box=document.getElementById(" ...

  4. kill&&pkill&&killall---删除执行中的程序

    命令功能: 发送指定的信号到相应进程.不指定型号将发送SIGTERM(15)终止指定进程.如果无法终止该程序可用“-KILL” 参数,其发送的信号为SIGKILL(9) ,将强制结束进程 使用ps命令 ...

  5. PHP防止Xss攻击

    mysql_real_escape_string() 所以得SQL语句如果有类似这样的写法:"select * from cdr where src =".$userId; 都要改 ...

  6. 【Codeforces Round #457 (Div. 2) B】Jamie and Binary Sequence

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 把n分解成二进制的形式. n=2^a0+2^a1+...+2^a[q-1] 则固定就是长度为q的序列. 要想扩展为长为k的序列. 可 ...

  7. Python批量重命名指定目录下文件的两种方法

    #法一 import os path = "C://Python34//" for file in os.listdir(path): if os.path.isfile(os.p ...

  8. hive load文件第一个字段为NULL

    在hive中,通常须要载入外部数据源.load文件时.第一个字段会出现NULL. 比如: 1.运行load语句: LOAD DATA LOCAL INPATH 'test.txt' OVERWRITE ...

  9. softInputMode- 软件盘监听事件

    软件盘的监听事件,如下 private final OnKeyListener mSubjectKeyListener = new OnKeyListener() { @Override public ...

  10. IIS进程回收 空闲时Net线程未运行

    最近手上的项目,用的是asp.net mvc,后台有个线程在循环接收socket数据,本身在系统运行的时候访问页面没问题,但是发现没访问时,后台没有接收数据,后来知道了是IIS把线程回收了.解决方法如 ...