HDU 1592 Half of and a Half(大数)
Half of and a Half
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1179 Accepted Submission(s): 539
"Ah, so many delicious chocolates! I'll get half of them and a half!" Speakless said.
Gardon went on his way, but soon he met YZG1984 by accident....
"Ah, so many delicious chocolates! I'll get half of them and a half!" YZG1984 said.
Gardon went on his way, but soon he met Doramon by accident....
"Ah, so many delicious chocolates! I'll get half of them and a half!" Doramon said.
Gardon went on his way, but soon he met JGShining by accident....
"Ah, so many delicious chocolates! I'll get half of them and a half!" JGShining said.
.
.
.
After had had met N people , Gardon finally met Angel. He gave her half of the rest and a half, then Gardon have none for himself. Could you tell how many chocolates did he bought from ACM?
Each case have a integer N, represents the number of people Gardon met except Angel. N will never exceed 1000;
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
int a[];
}s[];
int main()
{
int i,j,t,n;
s[].a[]=;
for(i=;i<=;i++)
{
int r=;
for(j=;j<;j++)
{
s[i].a[j]=s[i-].a[j]*+r; r=s[i].a[j]/; s[i].a[j]%=; }
t=;
while(s[i].a[t]+>)
{
s[i].a[t]=;
t++;
}
s[i].a[t]+=;
}
while(scanf("%d",&n)!=EOF)
{
for(i=;i>=,s[n].a[i]==;i--);
for(j=i;j>=;j--)
printf("%d",s[n].a[j]);
printf("\n"); }
return ;
}
HDU 1592 Half of and a Half(大数)的更多相关文章
- hdu 4099 Revenge of Fibonacci 字典树+大数
将斐波那契的前100000个,每个的前40位都插入到字典树里(其他位数删掉),然后直接查询字典树就行. 此题坑点在于 1.字典树的深度不能太大,事实上,超过40在hdu就会MLE…… 2.若大数加法时 ...
- HDU 5351 MZL's Border (规律,大数)
[HDU 5351 MZL's Border]题意 定义字符串$f_1=b,f_2=a,f_i=f_{i-1}f_{i-2}$. 对$f_n$的长度为$m$的前缀$s$, 求最大的$k$满足$s[1] ...
- HDOJ/HDU 1865 1sting(斐波拉契+大数~)
Problem Description You will be given a string which only contains '1'; You can merge two adjacent ' ...
- hdu 5429 Geometric Progression(存个大数模板)
Problem Description Determine whether a sequence is a Geometric progression or not. In mathematics, ...
- hdu 1002 A + B Problem II【大数加法】
题目链接>>>>>> 题目大意:手动模拟大数加法,从而进行两个大数的加法运算 #include <stdio.h> #include <strin ...
- hdu 5666 Segment 俄罗斯乘法或者套大数板子
Segment Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem ...
- HDU 1002 A + B Problem II (大数加法)
题目链接 Problem Description I have a very simple problem for you. Given two integers A and B, your job ...
- hdu 5973 Game of Taking Stones(大数,bash game¥)
Game of Taking Stones Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Ot ...
- hdu 1002 A + B Problem II(大数)
题意:就是求a+b (a,b都不超过1000位) 思路:用数组存储 第一道大数的题目,虽然很水,纪念一下! 代码: #include<cstdio> #include<cstring ...
随机推荐
- Python简单做二维统计图
先上一张效果图: 以上图是一段时间内黄金价格的波动图. 代码如下: import datetime as DT from matplotlib import pyplot as plt from ma ...
- 基于MySQl的分页显示
<%@page import="java.sql.DriverManager"%> <%@page import="java.sql.ResultSet ...
- python 获取IP
第一种 import commandscmd = "ifconfig br0 | grep 'inet addr' | sed 's/^.*addr://g' |sed 's/ Bcast: ...
- input聚焦后光标移动至末尾
var valSrc=obj.val();obj.val(“”).focus().val(valSrc);
- notification后,程序应该如何响应
一般来讲,点击一个notification后,都会打开一个Activity做为对点击事件的响应,这个Activity是之前在PendingIntent中设置好的. 经常玩Android手机的应该都有印 ...
- Python -- Scrapy 框架简单介绍(Scrapy 安装及项目创建)
Python -- Scrapy 框架简单介绍 最近在学习python 爬虫,先后了解学习urllib.urllib2.requests等,后来发现爬虫也有很多框架,而推荐学习最多就是Scrapy框架 ...
- python-day10--字符编码
1.回顾: 软件→操作系统→硬件 2.文本编辑器: 启动:硬盘→内存→运行(cpu) 读文件:硬盘→内存→CPU读 存文件:保存到硬盘中 3.python解释器 启动:硬盘→内存→运行(cpu) 读文 ...
- HDOJ1009
#include "iostream" #include "algorithm" #include "cstdio" using names ...
- spring boot 学习番外篇:超快速项目初始化
超快速完成 Spring Boot 项目初始化 最近,在浏览 SPRING 官网时,发现一个超级方便的小工具,可以帮助我们快速创建一个 Spring Boot 项目,前提就是你能连接互联网. 依赖 支 ...
- cas HttpServletRequestWrapperFilter
HttpServletRequestWrapperFilter 作用其实很简单就是 在HttpServletRequest对象在包装一次,让其支持getUserPrincipal,getRemoteU ...