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 ...
随机推荐
- js---- localStorage的基本用法
<body> <div> <span>用户名</span> <input type="text" class='usernam ...
- Unity 3D 开发 —— 脚本编程
Unity 相关资源 Unity 官网 :http://www.unity3D.com Unity 论坛 : http://forum.unity3d.com/forum.php Unity 问答 : ...
- 解决create-react-app 后 npm start 中出现 的webpack版本问题和webpack-dev-server的版本问题
利用VSCode搭建react的脚手架运行环境的时候.create-react-app之后npm start出现如下图的问题: There might be a problem with the pr ...
- 解决Not allowed to load local resource
在做视频上传的时候,发现Not allowed to load local resource,也弄了很久,怕自己忘记了所以记下来 bind: function() { SelectVideo.on(& ...
- 将已有的Eclipse项目转化为Maven项目
将已有的Eclipse项目转化为Maven项目 我们之前在Eclipse IDE完成的Java命令行项目.Java Web项目也使用了构建工具--Ant,它帮助我们编译.运行Java源代码(无需我们自 ...
- View_01_LayoutInflater的原理、使用方法
View_01_LayoutInflater的原理.使用方法 本篇博客是郭神博客Android视图状态及重绘流程分析,带你一步步深入了解View(一)的读书笔记的笔记. LayoutInflater简 ...
- RecyclerView具体解释
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChild { 由上面的继承结 ...
- 7lession-基础数据使用介绍
1.数值 这个使用比较简单 a = 1 b = 3.2 c = 12.5+4j d = 20L 2.字符串 代码 s = "hello world,i am comming" pr ...
- startActivityForResult()的用法
举例说我想要做的一个事情是,在一个主界面(主Activity)上能连接往许多不同子功能模块(子Activity上去),当子模块的事情做完之后就回到主界面,或许还同时返回一些子模块完成的数据交给主Act ...
- 内存泄漏与指针悬挂&野指针介绍
内存泄漏概念:内存泄漏时指动态申请的内存空间没有正常释放,但是也不能继续使用的情况. 例如: char *ch1; ch1 = new char('A'); char = *ch2 = new cha ...