200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > ZOJ 4535 ZOJ Monthly October H

ZOJ 4535 ZOJ Monthly October H

时间:2019-06-19 01:35:22

相关推荐

ZOJ 4535 ZOJ Monthly  October  H

How Many Sets ITime Limit: 2 Seconds Memory Limit: 65536 KB

Give a set S, |S| =n, then how many ordered set group (S1, S2, ..., Sk) satisfies S1 ∩ S2 ∩ ... ∩ Sk= ∅. (Si is a subset of S, (1 <=i<=k))

Input

The input contains multiple cases, each case have 2 integers in one line representnandk(1 <=k<=n<= 231-1), proceed to the end of the file.

Output

Output the total number mod 1000000007.

Sample Input

1 12 2

Sample Output

19

整套比赛最简单的一个。

可以直接写一个暴力程序,然后找规律。

规律很显然的~

我的代码:

#include<stdio.h>#include<iostream>using namespace std;typedef long long ll;ll mod=1000000007;ll power(ll p,ll n,ll m){ll sq=1;while(n>0){if(n%2==1)sq=(sq%m)*(p%m)%m;p=(p%m)*(p%m)%m;n=n/2;}return sq%m;}int main(){ll n,k,ans;while(cin>>n>>k){ans=power(2,k,mod)-1;ans=power(ans,n,mod);cout<<ans<<endl;}return 0;}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
ZOJ Monthly  August

ZOJ Monthly August

2024-04-04

ZOJ Monthly  March

ZOJ Monthly March

2019-10-11

ZOJ Monthly  August  题解

ZOJ Monthly August 题解

2021-11-06

ZOJ Monthly  January  记

ZOJ Monthly January 记

2024-02-10