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 ...
随机推荐
- 为什么mongo中不能用int作为key
为什么mongo中不能用int作为key??
- Web API过滤器
Web API包含在操作方法执行之前或之后添加额外的逻辑的过滤器.过滤器可用于提供横切特性,比如日志记录.异常处理.性能测量.身份验证和授权等等. 过滤器可以应用于Web API控制器或一个或多个操作 ...
- MVC ---- 理解学习Func用法
//Func用法 public static class FuncDemo{ public static void TestFunc(){ //数据源 List<User> usList ...
- pandas demo 示例
#构造 import pandas as pd import pickle import numpy as np dates=pd.date_range() df = pd.DataFrame(np. ...
- Jmeter ResponseAssertion 【Ignore Status】
在Jmeter源码中AssertionGui.java中,定义了Ignore Status的作用域 /** * Checkbox to indicate whether the response sh ...
- Lua面向对象 --- 封装
工程结构: Player.lua: Player = {} function Player:new() local self = {} setmetatable(self, {__index = Pl ...
- 最大容积 Container With Most Water
2018-07-31 17:28:42 问题描述: 问题求解: 很容易想到的是Brute Force,也就是枚举所有可能的pairs,这种解法的时间复杂度为O(n ^ 2),由于本题的数据规模较大,会 ...
- Python 错误与异常
2017-08-01 13:40:17 在程序运行过程中,总会遇到各种各样的错误. 有的错误是程序编写有问题造成的,比如本来应该输出整数结果输出了字符串,这种错误我们通常称之为bug,bug是必须修复 ...
- C#实现在应用程序间发送消息的方法示例
本文实例讲述了C#实现在应用程序间发送消息的方法.分享给大家供大家参考,具体如下: 首先建立两个C#应用程序项目. 第一个项目包含一个Windows Form(Form1),在Form1上有一个But ...
- OnXXX函数与XXX事件的关系
OnPaint是Control类中的方法,Paint是事件,Paint是用于改变部分显示用比较合适,实际上Paint事件在OnPaint中被调用,如果你重写OnPaint但是不调用base.OnPai ...