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. Linux questions

    1.can not use ifconfig http://blog.csdn.net/zjt289198457/article/details/6918644 add this : export P ...

  2. RHEL6.2下挂载光驱安装软件

    导读 在RHEL6.2命令行模式下挂载虚拟光驱安装软件也许会难倒许多新手,下面我给大家详细介绍一下.首先说明一下,本教程是以RHEL6.2版本下安装Apache为例.主要讲述挂载虚拟光驱的方法.环境: ...

  3. 见招拆招:绕过WAF继续SQL注入常用方法

    Web Hacker总是生存在与WAF的不断抗争之中的,厂商不断过滤,Hacker不断绕过.WAF bypass是一个永恒的话题,不少基友也总结了很多奇技怪招.那今天我在这里做个小小的扫盲吧.先来说说 ...

  4. 使用HTML5 Web存储的localStorage和sessionStorage方式

    localStorage(本地存储),可以长期存储数据,没有时间限制,一天,一年,两年甚至更长,数据都可以使用.sessionStorage(会话存储),只有在浏览器被关闭之前使用,创建另一个页面时同 ...

  5. stringbuffer 和 stringbuilder的区别

    1. stringbuffer 和 stringbuilder的区别 StringBuffer是线程安全的, 这个类里的所有方法是同步的.这个反过来就会对程序的性能有一定的影响.StringBuild ...

  6. exFAT是支持Mac和Win的

    exFAT是支持Mac和Win的 转自: http://bbs.feng.com/read-htm-tid-8214017.html

  7. 71 Query Rank Min Max Successor of BST

    [本文链接] http://www.cnblogs.com/hellogiser/p/query-min-max-successor-of-bst.html [代码]  C++ Code  12345 ...

  8. Java for LeetCode 066 Plus One

    Given a non-negative number represented as an array of digits, plus one to the number. The digits ar ...

  9. Java的++自增

    记得大学刚开始学C语言时,老师就说:自增有两种形式,分别是i++和++i,i++表示的是先赋值后加1,++i是先加1后赋值,这样理解了很多年也没出现问题,直到遇到如下代码,我才怀疑我的理解是不是错了: ...

  10. 【2016-08-06】QTableWidget的一些用法总结

    1. QTableWidget的列宽如何自适应显示区域大小? QTableWidget的列头继承自QHeaderView,因此如果不使用固定列宽而需要Table中多列的列宽自适应显示区域大小的话, 可 ...