poj 3100 (zoj 2818)||ZOJ 2829 ||ZOJ 1938 (poj 2249)
水题三题:
1.给你B和N,求个整数A使得A^n最接近B
2. 输出第N个能被3或者5整除的数
3.给你整数n和k,让你求组合数c(n,k)
1.poj 3100 (zoj 2818) Root of the Problem:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818
http://poj.org/problem?id=3100
#include<cstdio>
#include<cmath>
int main()
{
int b,n;
while(~scanf("%d%d",&b,&n),b||n)
{
int a=pow(b,1.0/n);
int ans=a;
if(b-pow(ans,n) > pow(ans+1,n)-b)
ans++;
printf("%d\n",ans);
}
return 0;
}
2.ZOJ 2829 Beautiful Number
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1829
#include<cstdio>
const int MAXN=300000;
int a[MAXN],len=1;
int main()
{
for(int i=3;i<MAXN;i++)
if(i % 3==0 || i %5==0)
a[len++]=i;
int n;
while(~scanf("%d",&n))
{
printf("%d\n",a[n]);
}
return 0;
}
3.ZOJ 1938 Binomial Showdown (poj 2249)
http://poj.org/problem?id=2249
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=938
#include<cstdio>
typedef long long LL;
LL ans,n,k;
int main()
{
while(scanf("%lld%lld",&n,&k),n)
{
ans=1;
if(k == 0)
{
printf("1\n");
continue;
}
if(k > n-k )k=n-k;
for(int i=1;i<=k;i++)
{
ans=ans*(n-i+1)/i;
}
printf("%lld\n",ans);
}
return 0;
}
poj 3100 (zoj 2818)||ZOJ 2829 ||ZOJ 1938 (poj 2249)的更多相关文章
- POJ 2235 Frogger / UVA 534 Frogger /ZOJ 1942 Frogger(图论,最短路径)
POJ 2235 Frogger / UVA 534 Frogger /ZOJ 1942 Frogger(图论,最短路径) Description Freddy Frog is sitting on ...
- POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!
水两发去建模,晚饭吃跟没吃似的,吃完没感觉啊. ---------------------------分割线"水过....."--------------------------- ...
- POJ 3100 & ZOJ 2818 & HDU 2740 Root of the Problem(数学)
题目链接: POJ:id=3100" style="font-size:18px">http://poj.org/problem? id=3100 ZOJ:http ...
- zoj 2818 Root of the Problem(数学思维题)
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 题目描述: Given positive integer ...
- POJ 3090 Visible Lattice Points (ZOJ 2777)
http://poj.org/problem?id=3090 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1777 题目大意: ...
- POJ 1775 Sum of Factorials (ZOJ 2358)
http://poj.org/problem?id=1775 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1334 题目大意: ...
- zoj 2818 Root of the Problem
Root of the Problem Time Limit: 2 Seconds Memory Limit: 65536 KB Given positive integers B and ...
- ZOJ 2679 Old Bill ||ZOJ 2952 Find All M^N Please 两题水题
2679:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1679 2952:http://acm.zju.edu.cn/onli ...
- ZOJ 3911 Prime Query ZOJ Monthly, October 2015 - I
Prime Query Time Limit: 1 Second Memory Limit: 196608 KB You are given a simple task. Given a s ...
随机推荐
- 配置远程访问阿里云服务器的Redis
1.默认情况Redis不是在后台运行,我们需要修改把redis放在后台运行:daemonize yes 2.Redis安全策略默认本机访问,所以远程访问的话需要将 bind 127.0.0.1加#注释 ...
- 漫漫人生路,学点Jakarta基础-Java8函数式编程
接口默认方法 Java8版本以后新增了接口的默认方法,不仅仅只能包含抽象方法,接口也可以包含若干个实例方法.在接口内定义实例方法(但是注意需要使用default关键字) 在此定义的方法并非抽象方法,而 ...
- 57.NodeJS入门--环境搭建 IntelliJ IDEA
转自:https://blog.csdn.net/wang19891106/article/details/51127133 NodeJS入门–环境搭建 IntelliJ IDEA 本人也刚开始学习N ...
- 学大伟业Day解题报告
预计分数:30+30+0=60 实际分数:30+20+0=50 题解部分全部来自http://www.cnblogs.com/TheRoadToTheGold/p/7723564.html T1htt ...
- BZOJ5332: [Sdoi2018]旧试题(莫比乌斯反演)
时光匆匆,转眼间又是一年寒暑…… 这是小 Q 同学第二次参加省队选拔赛. 今年,小 Q 痛定思痛,不再冒险偷取试题,而是通过练习旧 试题提升个人实力.可是旧试题太多了,小 Q 没日没夜地做题,却看不到 ...
- Python datetime time 等时间 日期 之间的计算和相互转化
from datetime import datetime, date, timedelta, timezone from time import time, ctime, localtime, st ...
- 程序猿果真有前端后端client吗
前端 后端 client DBA OP 程序猿有分这么细的吗? 入行时候有区别. 殊途同归 吾道一以贯之, 假设作为程序猿不能领悟一贯, 则永远不清楚.
- vmware-虚拟机播放器的下载、安装
如果是在window下安装的话: 1.下载vmware: 到官网下载免费个人版本 https://my.vmware.com/cn/web/vmware/free#desktop_end_user_c ...
- thinkphp最简单路由
thinkphp最简单路由 一.总结 1.路由应用场景(前台要,后台不要):前台所有人都可以看,所以前台的话设置路由,后台的话并不是所有人都进去,所以不需要设置路由 2.模块分离来实现路由场景应用:前 ...
- 1.3 Quick Start中 Step 6: Setting up a multi-broker cluster官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 6: Setting up a multi-broker cluster ...