1243. Divorce of the Seven Dwarfs

Time limit: 1.0 second
Memory limit: 64 MB
After the Snow White with her bridegroom had left the house of the seven dwarfs, their peaceful and prosperous life has come to an end. Each dwarf blames others to be the reason of the Snow White's leave. To stop everlasting quarrels, the dwarfs decided to part. According to an ancient law, their common possessions should be divided in the most fair way, which means that all the dwarfs should get equal parts. Everything that the dwarfs cannot divide in a fair way they give to the Snow White. For example, after dividing 26 old boots, each dwarf got 3 old boots, and the Snow White got the remaining 5 old boots. Some of the numbers are very large, for example, the dwarfs have 123456123456 poppy seeds, so it is not easy to calculate that the Snow White gets only one seed. To speed up the divorce, help the dwarfs to determine quickly the Snow White's part.
 
 
 

Input

The only line contains an integer N that represents the number of similar items that the dwarfs want to divide (1 ≤ N ≤ 1050).

Output

You should output the number of items that pass into the possession of the Snow White.

Sample

input output
123456123456
1
Problem Author: Stanislav Vasilyev
Problem Source: Ural State University Personal Programming Contest, March 1, 2003
Difficulty: 57
 
题意:输出x%7
分析:高精度除法
 #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int N = ;
int Arr[N], n;
char Str[N];
#define For(i, s, t) for(int i = (s); i <= (t); i++) int main()
{
scanf("%s", Str + );
n = strlen(Str + );
For(i, , n) Arr[i] = Str[i] - '';
int Last = ;
For(i, , n)
{
Last = Last * + Arr[i];
Last %= ;
}
cout << Last << endl;
return ;
}

ural 1243. Divorce of the Seven Dwarfs的更多相关文章

  1. 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 ...

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

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

  3. ural 2071. Juice Cocktails

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

  4. ural 2073. Log Files

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

  5. ural 2070. Interesting Numbers

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

  6. ural 2069. Hard Rock

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

  7. ural 2068. Game of Nuts

    2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...

  8. ural 2067. Friends and Berries

    2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...

  9. ural 2066. Simple Expression

    2066. Simple Expression Time limit: 1.0 secondMemory limit: 64 MB You probably know that Alex is a v ...

随机推荐

  1. Unity3D脚印6——模型动画

    原地址:http://www.cnblogs.com/ybgame/archive/2013/02/21/2920009.html 如何导入一个模型,导入的模型在unity3d的project面板中是 ...

  2. 他们在军训,我在搞 OI(四)

    (怎么自动变成两天一更了?) ——因为我菜啊 T_T Day 5 今天上午刷得爽啊!5 道 NOIP,前四题直接 1A,然而最后一题还是 WA 了一发才 A... 第一题是个简单的贪心,题意大概是 n ...

  3. 自动化运维之puppet的学习(如何找到你需要的模块)

    https://forge.puppetlabs.com/  puppet 模块下载 http://kisspuppet.com/2014/01/14/puppet_forge_modules/ pu ...

  4. ubuntu 桌面版性能调优

    http://www.howtogeek.com/115797/6-ways-to-speed-up-ubuntu/

  5. django-cms 代码研究(三)插件(plugs in)

    插件(plugs in) djangocms支持的插件有: http://docs.django-cms.org/en/latest/basic_reference/plugin_reference. ...

  6. TortoiseSVN中图标的含义

    今天在使用svn时发现有好多不认识了,所以查了下svn帮助手册.借此总结了下 svn 中图标的含义 一个新检出的工作复本使用绿色的勾做重载.表示Subversion状态 正常. 在开始编辑一个文件后, ...

  7. spring3 + mybatis + maven:junit测试错误

    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component c ...

  8. 【转】js onclick用法:跳转到指定URL

    使用onclick跳转到其他页面/跳转到指定url   ☆如果是本页显示可以直接用location,方法如下: ①onclick="javascript:window.location.hr ...

  9. static_cast dynamic_cast const_cast reinterpret_cast总结对比

    [本文链接] http://www.cnblogs.com/hellogiser/p/static_cast-dynamic_cast-const_cast-reinterpret_cast.html ...

  10. 【python】队列

    来源:http://www.cnblogs.com/yupeng/p/3413852.html 关于队列 >>> from collections import deque > ...