1283. Dwarf

Time limit: 1.0 second
Memory limit: 64 MB
Venus dwarfs are rather unpleasant creatures: ugly, malicious, and mean-spirited. Maybe it’s because of hard living conditions on their planet… but the fact remains: each of them is ready to sell his own mother in order to save up his pot of gold and to preserve it to the end of his days.
The dwarfs are especially nervous about the Mercury leprechauns who are always glad to empty a dwarf’s pot and to fill it with solar dust instead of the gold. The dwarfs are weak-sighted and can’t distinguish dust from gold. That is why each dwarf once a year visits the Central Galaxy Bank (CGB), where experienced specialists authenticate the content of the pot taking a small commission for the job.
When the amount of gold in a pot becomes less than or equal to a certain level, the life of a dwarf has no sense anymore, so he clears the world of his wretched soul: with the remaining gold he buys in a zoo the largest Jupiter toad and creeps under it which results in crushing his chest.

Input

The input contains three integers separated with spaces. The first number is the amount of gold in a dwarf’s pot at the initial moment. The second number is the amount of gold at which the dwarf’s life becomes senseless. Both values are measured in grams and don't exceed 231 − 1. The third number is the CGB commission (from 1 to 100); this is the percentage of gold that is taken from the pot as a way of payment for the verification.

Output

The output should contain the number of years that is left to the dwarf.

Samples

input output
19 10 50
1
1000 1 1
688
Problem Author: Leonid Volkov (prepared by Ivan Dashkevich)
Problem Source: USU Personal Contest 2004
Difficulty: 129
 
题意:输入一个数n,m表示钱的数量和下限(达到下限也会死),一个数k从1到100,表示每年用掉的钱的百分比,然后问多少年死?
分析:暴力
 
 #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
using namespace std;
typedef long long LL;
typedef double DB;
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, s, t) for(int i = (s); i >= (t); i--)
#define Rep(i, t) for(int i = (0); i < (t); i++)
#define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
#define rep(i, x, t) for(int i = (x); i < (t); i++)
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair
inline void SetIO(string Name)
{
string Input = Name + ".in",
Output = Name + ".out";
freopen(Input.c_str(), "r", stdin),
freopen(Output.c_str(), "w", stdout);
} inline int Getint() {
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '') {
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const DB Eps = 1e-;
DB a, b, c;
LL Ans; inline void Input() { } inline void Solve() {
for(cin >> a >> b >> c; a > b + Eps; a -= a * c / 100.0, Ans++) ;
cout << Ans << endl;
} int main() {
#ifndef ONLINE_JUDGE
SetIO("A");
#endif
Input();
Solve();
return ;
}

ural 1283. Dwarf的更多相关文章

  1. ural 1243. Divorce of the Seven Dwarfs

    1243. Divorce of the Seven Dwarfs Time limit: 1.0 secondMemory limit: 64 MB After the Snow White wit ...

  2. URAL - 1243 - Divorce of the Seven Dwarfs (大数取模)

    1243. Divorce of the Seven Dwarfs Time limit: 1.0 second Memory limit: 64 MB After the Snow White wi ...

  3. dwarf tower

    dwarf tower(dwarf.cpp/c/pas)[问题描述]Vasya在玩一个叫做"Dwarf Tower"的游戏,这个游戏中有n个不同的物品,它们的编号为1到n.现在Va ...

  4. dwarf格式解析

    debug_line中包含的是地址和源文件行之间的关系 我今天想搞清楚的是文件的C代码和汇编代码之间的关系: 对这块之前一直是迷迷糊糊的,发现这个问题已经严重影响到bug的定位了. 之前感觉C和汇编不 ...

  5. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  6. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  7. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  8. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  9. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

随机推荐

  1. UIWebView

    本地html string文件 loadHTMLString: 本地/远程文件 loadRequest

  2. hiho一下 第九十五周 数论四·扩展欧几里德

    题目 : 数论四·扩展欧几里德 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho周末在公园溜达.公园有一堆围成环形的石板,小Hi和小Ho分别站在不同的石板上 ...

  3. hibernate.cfg.xml配置文件和hbm.xml配置文件 模板

    hibernate.cfg.xml配置文件格式 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE ...

  4. 数学复习 ---- Mathematics Notes: A Programmer's Perspective ---- by Orzer ---- 我是沙茶

    今年是好没长进的一年呢..只学了些基本的方法.. 本文记号0] x:p x类型为p1] f(x) 表示一个函数2] (n_1,n_2,...) 表示多元组,特别的,(n)表示一个一元组3] x 表示一 ...

  5. 【Python】python list 迭代删除

    最好方式使用filter,代码示例: def _filter(self, item): ): return False return True #lambda e:e%!= data['items'] ...

  6. Longest Consecutive Sequence

    Given an unsorted array of integers, find the length of the longest consecutive elements sequence. C ...

  7. HTML5 manifest离线缓存

    一.基本概念 离线缓存是HTML5新引入的技术,能够让你的Web应用程序指定哪些文件可以缓存在本地,使得你的网络断开时依然可以通过本地的缓存来进行访问浏览. 二.使用方法 1. MIME type 声 ...

  8. 【转】cas注册后自动登录

    本文转自:http://denger.iteye.com/blog/805743  1. 关于CAS的介绍不再累述,我想涉及过SSO同学应该都会对该框架所有了解,我们目前项目采用的CAS Server ...

  9. iOS tableview 选中Cell后的背景颜色和文字颜色

    做下记录,备忘 改文字颜色其实是UILabel的属性,改背景颜色是cell的属性,都和tableview无关. cell.textLabel.textColor = BAR_COLOR; cell.t ...

  10. Android 中的code sign

    Android 中和ios中都有code sign.它们的目的一样,都是要保证程序的可靠性,最基本实现原理也一样.但是sign的过程比较不同. 下面记录一点Android sign的重要知识. 请参看 ...