hdu_3063_Play game(数论)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3063
题意:中文题,说的很清楚,不解释
题解:公式题,具体看代码
#include<stdio.h>
#include<string.h>
#define mod 4*9999
/*
需要用到的公式:
1*2*3+2*3*4+3*4*5+...+n*(n+1)(n+2)= (n*(n+1)*(n+2)*(n+3))/4
(a + b) % p = (a % p + b % p) % p
(a *b) % p = (a % p * b % p) % p
(a/b)%p=(a%(b*p))/b
*/
int main(){
__int64 n,i,s,sum;char str[];
while(~scanf("%s",str)){
s=strlen(str);sum=;
for(i=;i<s;i++)
sum=(sum*+str[i]-''),sum%=mod;
n=sum*(sum+)*(sum+)*(sum+)/;
printf("%I64d\n",n%);
}
return ;
}
hdu_3063_Play game(数论)的更多相关文章
- Codeforces Round #382 Div. 2【数论】
C. Tennis Championship(递推,斐波那契) 题意:n个人比赛,淘汰制,要求进行比赛双方的胜场数之差小于等于1.问冠军最多能打多少场比赛.题解:因为n太大,感觉是个构造.写写小数据, ...
- NOIP2014 uoj20解方程 数论(同余)
又是数论题 Q&A Q:你TM做数论上瘾了吗 A:没办法我数论太差了,得多练(shui)啊 题意 题目描述 已知多项式方程: a0+a1x+a2x^2+..+anx^n=0 求这个方程在[1, ...
- 数论学习笔记之解线性方程 a*x + b*y = gcd(a,b)
~>>_<<~ 咳咳!!!今天写此笔记,以防他日老年痴呆后不会解方程了!!! Begin ! ~1~, 首先呢,就看到了一个 gcd(a,b),这是什么鬼玩意呢?什么鬼玩意并不 ...
- hdu 1299 Diophantus of Alexandria (数论)
Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- 【BZOJ-4522】密钥破解 数论 + 模拟 ( Pollard_Rho分解 + Exgcd求逆元 + 快速幂 + 快速乘)
4522: [Cqoi2016]密钥破解 Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 290 Solved: 148[Submit][Status ...
- bzoj2219: 数论之神
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- hdu5072 Coprime (2014鞍山区域赛C题)(数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5072 题意:给出N个数,求有多少个三元组,满足三个数全部两两互质或全部两两不互质. 题解: http://dty ...
- ACM: POJ 1061 青蛙的约会 -数论专题-扩展欧几里德
POJ 1061 青蛙的约会 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %llu Descr ...
- 数论初步(费马小定理) - Happy 2004
Description Consider a positive integer X,and let S be the sum of all positive integer divisors of 2 ...
随机推荐
- win10十周年更新后cent os 虚拟机无法连接到xshell
1.在vmware中打开编辑-->虚拟网络编辑器-->还原默认设置
- Sub Lime Text
Sub Lime Text License -– BEGIN LICENSE -– Andrew Weber Single User License EA7E-855605 813A03DD 5E4A ...
- dropdown-toggle 的点击禁用
<div class="dropdown select-dropdown" id="choiceTagdiv"> <a class=" ...
- Javaweb 第12天 JSP、EL技术
第12天 JSP.EL技术 今日任务: JSP技术入门和常用指令 JSP的内置对象&标签介绍 EL表达式&EL的内置对象 课堂笔记 1.JSP技术入门和常用指令 1.1.JSP的由来. ...
- spring-security 配置文件
转自:spring-security学习笔记--配置文件 <?xml version="1.0" encoding="UTF-8"?> <be ...
- Windows10 Apache2.4 PHP7 MySQL 5.7安装教程
最近细细的折腾了win10下PHP环境的安装过程,每次安装总是有小问题,现在总结一下.安装之前需要注意,下载的安装包(除MySQL)外必须统一是64位或者统一时32位. 一. MySQL5.7的安装 ...
- Java 反射 调用私有域和方法(setAccessible)
Java 反射 调用私有域和方法(setAccessible) @author ixenos AccessibleObject类 Method.Field和Constructor类共同继承了Acces ...
- Zeppelin添加mysql解释器
安装Apache zeppelin 1 wget http://apache.fayea.com/zeppelin/zeppelin-0.6.2/zeppelin-0.6.2-bin-all.tgz ...
- Storm中-Worker Executor Task的关系
Storm在集群上运行一个Topology时,主要通过以下3个实体来完成Topology的执行工作:1. Worker(进程)2. Executor(线程)3. Task 下图简要描述了这3者之间的关 ...
- LeetCode OJ 40. Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in ...