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 ...
随机推荐
- Eclipse中JDK的配置
window -> preference -> java -> install jres -> add -> standard vm -> 设置好相应的jre ho ...
- C#List<string>和string[]之间的相互转换
一.LIST概述 所属命名空间:System.Collections.Generic public class List<T> : IList<T>, IColle ...
- Atcoder ABC 071 C,D
C - Make a Rectangle Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement W ...
- enable&&builtin---shell内部命令
用enable命令显示所有激活的内部命令: [root@localhost ~]# enable -a builtin命令用于执行指定的shell内部命令,并返回内部命令的返回值 [root@xiao ...
- 今日SGU 5.5
SGU 114 题意:求一个点到其他点的距离总和最小,距离的定义是x轴距离乘以那个点的人数p 收获:带权中位数,按坐标排序,然后扫一遍,最后权值超过或等于总权值的一半时的那个点就是答案,证明暂无 #i ...
- 5.Node.js 安装配置
转自:http://www.runoob.com/nodejs/nodejs-tutorial.html Node.js安装包及源码下载地址为:https://nodejs.org/en/downlo ...
- 7.Maven之(七)pom.xml配置文件详解
转自:https://blog.csdn.net/qq_33363618/article/details/79438044 setting.xml主要用于配置maven的运行环境等一系列通用的属性,是 ...
- SQL中实现千分位的语句
传递一个sql的小知识,现成的语句,在工作流的表单域中很实用. 数字或字符串转成千分位 ) 字符串转换成数值 )
- Flume的Storage&Master
storage是存储系统,可以是一个普通file,也可以是HDFS,HIVE,HBase,分布式存储等. Master是管理协调Agent和Collector的配置等信息,是flume集群的控制器.
- 1.26 Python知识进阶 - 继承
继承 继承(Inheritance)是面向对象的程序设计中代码重要的主要方法.继承是允许使用现有类的功能,并在无需重新改写原来的类的情况下,对这些功能进行扩展.继承可以避免代码复制和相关的代码维护等问 ...