数学--数论--HDU 6063 RXD and math (跟莫比乌斯没有半毛钱关系的打表)
RXD is a good mathematician.
One day he wants to calculate:

output the answer module 109+7. 
p1,p2,p3…pk are different prime numbers
Input
There are several test cases, please keep reading until EOF.
There are exact 10000 cases.
For each test case, there are 2 numbers n,k.
Output
For each test case, output “Case #x: y”, which means the test case number and the answer.
Sample Input
10 10
Sample Output
Case #1: 999999937
看见这个题不可能去正常做,尝试达标找规律,然后找了 n^K的规律
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
ll ksm(ll n, ll k)
{
ll r = 1;
for (; k; k >>= 1)
{
if (k & 1)
r = r * n % mod;
n = n * n % mod;
}
return r;
}
int main()
{
ll x, y, ca = 1;
while (~scanf("%lld%lld", &x, &y))
{
// x大于mod这题就没法做了
x=x%mod; //利用费马小定理
cout << "Case #" << ca++ << ": " << ksm(x, y) << endl;
}
}
数学--数论--HDU 6063 RXD and math (跟莫比乌斯没有半毛钱关系的打表)的更多相关文章
- 2017 ACM暑期多校联合训练 - Team 3 1008 HDU 6063 RXD and math (莫比乌斯函数)
题目链接 Problem Description RXD is a good mathematician. One day he wants to calculate: ∑i=1nkμ2(i)×⌊nk ...
- HDU 6063 - RXD and math | 2017 Multi-University Training Contest 3
比赛时候面向过题队伍数目 打表- - 看了题解发现确实是这么回事,分析能力太差.. /* HDU 6063 - RXD and math [ 数学,规律 ] | 2017 Multi-Universi ...
- hdu 6063 RXD and math(快速幂)
RXD and math Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)To ...
- HDU - 6063 RXD and math
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6063 打表发现规律是n^k #include <iostream> #inc ...
- 数学--数论--HDU - 6395 Let us define a sequence as below 分段矩阵快速幂
Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only ...
- 数学--数论-- HDU 2601 An easy problem(约束和)
Problem Description When Teddy was a child , he was always thinking about some simple math problems ...
- 数学--数论--HDU 1098 Ignatius's puzzle (费马小定理+打表)
Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so h ...
- 数学--数论--HDU 2582 F(N) 暴力打表找规律
This time I need you to calculate the f(n) . (3<=n<=1000000) f(n)= Gcd(3)+Gcd(4)+-+Gcd(i)+-+Gc ...
- [数论] hdu 5974 A Simple Math Problem (数论gcd)
传送门 •题意 一直整数$a,b$,有 $\left\{\begin{matrix}x+y=a\\ LCM(x*y)=b \end{matrix}\right.$ 求$x,y$ •思路 解题重点:若$ ...
随机推荐
- MySQL入门,第八部分,多表查询(一)
一.数据库脚本 #-------------------------------------------------------------------------------- #--------- ...
- C语言 文件操作(一)
#include<stdio.h> int main(){ FILE *fp = fopen("f:\\lanyue.txt","r&quo ...
- 汇编 RET 和 CALL
https://blog.csdn.net/u013018721/article/details/51264199 1.我们先来实践一下 ret 指令 DATA SEGMENT A DB 12H B ...
- 第一天总结(while计数器+成绩大小+获取时间+猜拳大小)
#*_* coding:utf-8 *_*# while 先有一个计数器 input = 0# input = input('输入数字')while input < 5: input= inpu ...
- 安卓广播api介绍,给自己理清楚概念
广播接收器类概述 这是用于接收由sendBroadcast()发送intent的基类.这个类一般都会被继承重写里面的onReceive()方法..如果您不需要跨应用程序发送广播,请考虑使用LocalB ...
- api_DZFPKJ & api_DZFPCX(get_AES_url代码优化)
通过AES加密网站的接口来传值,不需要手动加密字符串后复制过来传值. #coding:utf-8 import requests import re def get_aes_url(key, text ...
- 详解 通道 (Channel 接口)
在本篇博文中,本人主要讲解NIO 的两个核心点 -- 缓冲区(Buffer) 和 通道 (Channel)之一的 缓冲区(Buffer), 有关NIO流的其他知识点请观看本人博文<详解 NIO流 ...
- IN612 IN612L蓝牙5.0 SoC芯片替换NRF52832/NRF52840
IN612L是美国公司INPLAY的SOC产品系列之一,具有多模协同2.4G无线协议栈,支持2.4G私有协议栈以及蓝牙5.0全协议栈的SOC芯片.如2mbps高数据速率模式,125kbps/500kb ...
- 杂记三 · CSP-2019-The first step
update:我终于懂得衰亡的民族之所以沉默的缘由了. 初赛Day -7 虽然我是第一次参加初赛而且到现在为止我还没见过初赛题但我一点也不慌! 真的!一点!也不慌! 初赛Day 1 早上和可s爱b j ...
- Java 反射调用方法 - 不跳过安全检查、跳过安全检查和普通方法性能比较测试
java中反射提供灵活性同时,给运行效率带来了一定影响.写个代码测试一下 package com.xzlf.reflectTest; import java.lang.reflect.Method; ...