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. ios代理的使用,正向传值,逆向传值

    #import <UIKit/UIKit.h> #import "SubViewController.h" @interface ViewController : UI ...

  2. 77.深入理解nodejs中Express的中间件

    转自:https://blog.csdn.net/huang100qi/article/details/80220012 Express是一个基于Node.js平台的web应用开发框架,在Node.j ...

  3. hadoop-2.6.0.tar.gz + hive-1.0.0.tar.gz + pig-0.15.0.tar.gz的安装

    这里,为什么选择用hadoop-2.6.0.tar.gz  +   hive-1.0.0.tar.gz是为了搭配兼容. hadoop-2.6.0.tar.gz  +   hive-1.0.0.tar. ...

  4. LuoguP2754 [CTSC1999]家园(分层图,最大流)

    题目背景 none! 题目描述 由于人类对自然资源的消耗,人们意识到大约在 2300 年之后,地球就不能再居住了.于是在月球上建立了新的绿地,以便在需要时移民.令人意想不到的是,2177 年冬由于未知 ...

  5. id---显示用户ID

    d命令   id命令可以显示真实有效的用户ID(UID)和组ID(GID).UID 是对一个用户的单一身份标识.组ID(GID)则对应多个UID 语法 id [-gGnru][--help][--ve ...

  6. Python-Flask项目开发--为什么需要搭建虚拟环境?

    在使用python开发过程中,需要使用到某些工具包/框架等,需要联网下载.   例如,联网安装Flask框架flask-0.10.1版本:pip install flask==0.10.1   此时, ...

  7. Mysql学习总结(16)——Mysql之数据库设计规范

    一.三大范式 1.第一范式:消除一个字段包含多个数据库值,消除一个记录包含重复的组(单独的一列包含多个项目),即可满足1NF. 2.第二范式:消除部分依赖性即可转化为2NF.部分依赖性表示一个记录中包 ...

  8. 4.使用fastjson进行json字符串和List的转换

    转自:https://blog.csdn.net/lipr86/article/details/80833952 使用fastjson进行自定义类的列表和字符串转换 1.环境 jdk1.8,fastj ...

  9. Trie&可持久化Trie

    WARNING:以下代码未经测试,若发现错误,欢迎指出qwq~ Trie树(字典树) 一种简单的数据结构,可存储大量字符串,可在$O(len)$的时间内完成插入,删除,查找等操作. 下面是一个简单的例 ...

  10. Java中的线程模型及实现方式

    概念: 线程是一个程序内部的顺序控制流 线程和进程的比较: 每个进程都有独立的代码和数据空间(进程上下文),进程切换的开销大. 线程:轻量的进程,同一类线程共享代码和数据空间,每个线程有独立的运行栈和 ...