HDU 5690:2016"百度之星" - 初赛 All X
原文链接:https://www.dreamwings.cn/hdu5690/2657.html
All X
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 703 Accepted Submission(s): 328
每组测试数据占一行,包含四个数字
第一行输出:"Case #i:"。代表第组测试数据。
第二行输出“Yes” 或者 “No”,代表四个数字,是否能够满足题目中给的公式。
3 1 3 5 2 1 3 5 1 3 5 99 69
Case #1: No Case #2: Yes Case #3: YesHint对于第一组测试数据:111 mod 5 = 1,公式不成立,所以答案是”No”,而第二组测试数据中满足如上公式,所以答案是 “Yes”。
AC代码:
#include <iostream>
#include <stdio.h>
typedef long long LL;
using namespace std;
LL modexp(LL a,LL b,LL n)
{
LL ret=1;
LL tmp=a;
while(b)
{
//基数存在
if(b&0x1) ret=ret*tmp%n;
tmp=tmp*tmp%n;
b>>=1;
}
return ret;
}
int main()
{
//printf("%d\n",modexp(3,2,5));
int N;
cin>>N;
for(int i=1;i<=N;i++)
{
LL x,m,k,c;
cin>>x>>m>>k>>c;
LL mo=9*k;
LL a=(modexp(10,m,mo)*x)%mo-x;
printf("Case #%d:\n",i);
if(a==9*c)printf("Yes\n");
else printf("No\n");
}
return 0;
}
HDU 5690:2016"百度之星" - 初赛 All X的更多相关文章
- hdu 5690 2016"百度之星" - 初赛(Astar Round2A) All X 快速二次幂 || 寻找周期
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5690 题意:m个数字全为x mod k ?= c;其中m <= 1010,0 < c,k ...
- 2016"百度之星" - 初赛(Astar Round2A)HDU 5695 拓扑排序+优先队列
Gym Class Time Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- 2016百度之星 初赛2A ABEF
只做了1001 1002 1005 1006.剩下2题可能以后补? http://acm.hdu.edu.cn/search.php?field=problem&key=2016%22%B0% ...
- 2016"百度之星" - 初赛(Astar Round2A)--HDU 5690 |数学转化+快速幂
Sample Input 3 1 3 5 2 1 3 5 1 3 5 99 69 Sample Output Case #1: No Case #2: Yes Case #3: Yes Hint ...
- 2016"百度之星" - 初赛(Astar Round2A)1002 / HDU 5691 状态压缩DP
Sitting in Line Problem Description 度度熊是他同时代中最伟大的数学家,一切数字都要听命于他.现在,又到了度度熊和他的数字仆人们玩排排坐游戏的时候了.游戏的规则十 ...
- 2016百度之星 初赛2B ACEF
做了1001 1003 1005 1006 看题:http://bestcoder.hdu.edu.cn/contests/contest_show.php?cid=702 交题:http://acm ...
- 2016"百度之星" - 初赛(Astar Round2A)
题目链接: http://bestcoder.hdu.edu.cn/contests/contest_show.php?cid=701 1001 : 矩阵快速幂 #include <iostre ...
- 2016"百度之星" - 初赛(Astar Round2B) 1006 中位数计数
思路:统计当前数左边比它小|大 i个人,相应右边就应该是比它大|小i个人 l数组表示左边i个人的方案 r表示右边i个人的方案 数组下标不可能是负数所以要加n //#pragma comment(lin ...
- 2016 百度之星初赛 Gym Class(优先队列+拓扑排序)
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Pract ...
随机推荐
- 手机自带的显示基站命令(android手机定位,iphone基站定位)
手机自带的显示基站命令(安卓手机定位,苹果手机基站定位) 分类: 通信和网络2012-02-07 17:48 1734人阅读 评论(0) 收藏 举报 手机htciphone中兴三星网络 安卓手机自带快 ...
- Vue 双向数据绑定原理分析 以及 Object.defineproperty语法
第三方精简版实现 https://github.com/luobotang/simply-vue Object.defineProperty 学习,打开控制台分别输入以下内容调试结果 userInfo ...
- 设置mariadb字符集为utf8
我用的是10.0.25 mariadb, 在centos7系统上,用以下指令设置数据库字符集. [client] default-character-set=utf8 [mysql] defa ...
- php 执行的目录到新的 directory 目录中
chdir : 改变目录. dir : 目录类别类. closedir : 关闭目录 handle. opendir : 打开目录 handle. readdir : 读取目录 handle. rew ...
- Struts 2.x No result defined for action 异常
这是我跑struts2的第一个例子,跑的也够郁闷的,这个问题烦了我几个钟... 2011-5-10 10:10:17 com.opensymphony.xwork2.util.logging.co ...
- Read4096
Given API: int Read4096(char* buf); It reads data from a file and records the position so that the n ...
- struct大小
对齐. #include <iostream> using namespace std; struct S1 { int a; char b; char c; }; struct S2 { ...
- HDU 4287 Intelligent IME(字典树数组版)
Intelligent IME Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 最实用的IT类网站及工具大集合[转]
1.聚合数据 大家在开发过程中,可能会用到各种各样的数据,想找一些接口来提供一些数据.比如天气预报查询,火车时刻表查询,彩票查询,身份证查询等等.有了这个接口,直接调用即可.各种各样的API接口满足你 ...
- [IT新应用]如何用好搜索引擎学习英语
用谷歌可以学习英语,用必应也可以的. 输入如下地址:global.bing.com,如果是中文界面,就单击顶部右侧“Switch to Bing in English”. 这个界面有很多英文原版的时事 ...