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. easyui 删除行bug

    easyui删除行,出现了bug.(经常使用这个框架的人几乎都会遇到) 我也非常纳闷,今天特地试了很久. 最后发现,如果是自己datagrid('getRows') 然后迭代出来,最后算出行号,可以成 ...

  2. RPM软件包管理的查询功能

    以后大家升级rpm包的时候,不要用Uvh了! 我推荐用Fvh 前者会把没有安装过得包也给装上,后者只会更新已经安装的包   总结:未安装的加上小写p,已安装的不需要加p   查询q    rpm {- ...

  3. 【Spring】Spring系列7之Spring整合MVC框架

    7.Spring整合MVC框架 7.1.web环境中使用Spring 7.2.整合MVC框架 目标:使用Spring管理MVC的Action.Controller 最佳实践参考:http://www. ...

  4. vi命令的基础知识

    vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,先说说一下它的用法和一小部分指令.由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您 ...

  5. 31.从尾到头输出链表[Print linked list from last to first]

    [题目] 输入一个链表的头结点,从尾到头反过来输出每个结点的值. [分析] 这是一道很有意思的面试题.该题以及它的变体经常出现在各大公司的面试.笔试题中. [链表逆置] 看到这道题后,第一反应是从头到 ...

  6. 修改Tomcat服务器的默认端口号

    tomcat服务器的默认端口号是8080,我们也可以修改为其他端口号,并且在没有启动Apache,IIS等占用80端口的web服务时,我们也可以设置为80端口,这样在生产中域名之后就可以不带端口号了, ...

  7. intellij 2016注册

    第一种方法: http://idea.qinxi1992.cn http://idea.imsxm.com/ http://107.191.37.186:11688

  8. python基础——字符串和编码

    python基础——字符串和编码 字符串也是一种数据类型,但是,字符串比较特殊的是还有一个编码问题. 因为计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理.最早的计算机在设计时采用 ...

  9. Java内部类的访问规则

    1.内部类可以直接访问外部类中的成员,包括私有      原因:因为在内部类中持有一个外部类的应用,格式:外部类.this class Outer {     private int x = 1; c ...

  10. Android Studio安装与配置

    谷歌已经停止支持eclipse开发android了,转向android studio是大势所趋,笔者由于电脑配置的原因, 以前迟迟不愿意向android studio,现如今因为开始学习materia ...