1 scanf("%s%d",a,&b);2 int len=strlen(a);3 int ans=0;4 for(int i=st;i 0, b fits into a 32 bit signed integer). Numbers will not contain leading zeroes...
分类:
其他好文 时间:
2015-07-19 20:00:28
阅读次数:
134
题目链接:Big Number
题目大意:每次输入两个数,第一个是高精度,第二个数小于100000;求 a mod b
根据同余定理:
(a+b)% c = (a%c+ b%c)%c
(a*b)%c = ( a%c* b%c)%c
所以 对于大数,例如 :123 可以这样分解
123 = (1*10+2)*10 + 3;
123 % c = ( (...
分类:
其他好文 时间:
2015-05-23 14:16:41
阅读次数:
138
题意:求出1^m+2^m+...n^m思路:直接套用模板#include#include#include#include#include#include#include#include#include#define LL long longusing namespace std;const LL m...
分类:
其他好文 时间:
2015-03-30 01:08:55
阅读次数:
134
大数取模,把输入的大数的字符串转换为整数,但同时每一步要取模(老是错在这里),不然就爆了int! ----> temp = ((temp * 10) + (s[i]-'0')) % a[j]; 1 #include 2 #include 3 #include 4 #include 5 6...
分类:
其他好文 时间:
2015-03-21 15:19:49
阅读次数:
93
题目及代码
Problem Description
As we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to calculate A mod B.
To make the problem ...
分类:
其他好文 时间:
2015-02-20 14:09:40
阅读次数:
345
The Embarrassed Cryptographer
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 12496
Accepted: 3330
Description
The young and very promising cryptographer Odd...
分类:
其他好文 时间:
2015-01-22 18:07:00
阅读次数:
206
//大数取模
#include "cmath"
#include "iostream"
#include "string.h"
using namespace std;
int mod(char str[],int num)
{
int number[100];
for(int i=0;i<strlen(str);i++)
number[i]=str[i]-'0';
...
分类:
其他好文 时间:
2015-01-22 01:49:12
阅读次数:
277
UVA128 - Software CRC(大数取模)
题目链接
题目大意:给你一个字符串,这个字符串代表的是256进制的一个数,要求在这个字符串后面再加上两个两个字节,使得这个新的字符串的值取模于34943等于0.最后要求你输出这两个字节(十六进制)。
解题思路:256进制的数先转化成十进制的数m,然后求出还需要的数n使得(n + m)%34943 ==0 ,最后再将n转换成1...
分类:
其他好文 时间:
2014-11-12 11:49:04
阅读次数:
185
题目链接BFedya and Maths按照题目的公式求数,有一个规律4的倍数为4,然后就是大数取模,但是我还二的把strlen(s)放到了循环上,导致了每次循环都要算一次,最后超时。本来很简单的,, 简直惨。。。 1 #include 2 #include 3 #include 4 #inc...
分类:
其他好文 时间:
2014-08-09 13:15:37
阅读次数:
180