牛客小白月賽-C
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
BigInteger a = in.nextBigInteger();
BigInteger b = in.nextBigInteger();
long c = in.nextLong();
long d = in.nextLong();
BigInteger r = in.nextBigInteger();
BigInteger m=a.multiply(b);
long n=c*d;
BigInteger t=m.modPow(BigInteger.valueOf(n), r);
System.out.println(t);
in.close();
}
}
相關推薦
牛客小白月賽-C
import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String[] args){ Scanner in = new
牛客小白月賽4 C 病菌感染 dfs
pre dfs 示例 include http ac代碼 www. namespace space 鏈接:https://www.nowcoder.com/acm/contest/134/C來源:牛客網 題目描述 鐵子和順溜上生物課的時候不小心將幾滴超級病菌滴到了培
牛客小白月賽9 C 紅球進黑洞【線段樹+模擬位運算】
時間限制:C/C++ 3秒,其他語言6秒 空間限制:C/C++ 262144K,其他語言524288K 64bit IO Format: %lld 題目描述 在心理疏導室中有一種奇特的疏導工具,叫做紅球。紅球被提前分為了許多正方形小方格。 每當有人來找ATB做心理疏導時,AT
紅球進黑洞【線段樹區間更新+二進位制異或處理】【牛客小白月賽9-C】
題目連結 給你N個點,M次查詢,問的是(一)、區間【l, r】的數的總和;(二)、把區間【l, r】上的所有點去異或(xor)一個數X。 一開始用了點更新,然後T了,想了一會,最後在比賽結束前終於美滋滋的完成了AC,慶幸,我的想法是這樣的,將每個
牛客小白月賽9 - A、B、C、H
A - 簽到 - 逆元 題目描述 你在一棟樓房下面,樓房一共有n層,第i層每秒有pi的概率會扔下一個東西並砸到你 求第一秒內你被砸到的概率 輸入描述: 第一行一個整數n 之後有n行,第i+1行有兩個整數ai,bi,表示 輸出描述: 設答案為,你只需要找到一個最小的非負整數T,
牛客小白月賽8-C 神祕鑰匙
思路:題目公式為 ans=C(1,n)*1+C(2,n)*2+...+C(n-1,n)*(n-1)+C(n,n)*n ans-n=C(1,n)*1+C(2,n)*2+...+C(n-1,n)*(n-1) 將右邊反向相加得 2*(ans-n)=(C(1,n)*1+C
牛客小白月賽10 A,B,C,D
傳送門 連結:https://ac.nowcoder.com/acm/contest/280/A 來源:牛客網 題目描述 Actci偶然發現了一個礦洞,這個礦洞的結構類似與一棵二叉樹,Actci發現的礦洞恰好位於根節點處,為了儘快挖掘,Actci找來了她的小夥伴們來幫忙,由於地質原因
牛客小白月賽10 A,B,C,D題解
A 勘測: 題目: 傳送門A 思路: 找規律,通過找出前幾天的建設道路的次數發現為斐波那契額數列,然後求前n項的和即可。 程式碼如下: #include <bits/stdc++.h> using namespace std; typedef long long
C 約數(牛客小白月賽10)
連結:https://ac.nowcoder.com/acm/contest/280/C 來源:牛客網 時間限制:C/C++ 1秒,其他語言2秒 空間限制:C/C++ 32768K,其他語言65536K 64bit IO Format: %lld 題目描述 Actci上課睡了一覺,下課屁顛屁
牛客小白月賽9 A、B、C、D、E、H
傳送門 A 被砸到的概率 = 1 - 不被砸到的概率 而不被砸到的概率很容易計算。 程式碼: #include<cstdio> using namespace std; typedef long long ll; const ll mod=1e9+7; const
牛客小白月賽5 C 水題(water) 求末尾0個數 ,n皇后問題
連結 : 傳送們 這個式子是斐波那契數列的一個,更多見 斐波那契數列常見式子 那這道題就簡單了,就是x 是否為斐波那契數列 1. 是 輸出 x! 在m進位制下的末尾0的個數 2. 不是 輸出 z (1-13) 皇后問題的個數 一 求末尾0的個數
牛客網 牛客小白月賽8 C-神祕鑰匙
玄學之門題目:分析:程式碼: 題目: 傳送門 分析: 數論題,沒什麼可以多說,直接證明: 1.方案數=∑i=1ni∗Cni1.方案數=\sum_{i=1}^ni*C_n^i1.方案數=i=1∑ni
牛客小白月賽4-C-病毒感染 推論或BFS
題解是個結論:全是NO!!!#include <stdio.h> int main() { int n,m; scanf("%d%d",&n,&m);
牛客小白月賽5 I-區間 C++
題目描述 Apojacsleam喜歡陣列。 他現在有一個n個元素的陣列a,而他要對a[L]-a[R]進行M次操作: 操作一:將a[L]-a[R]內的元素都加上P 操作二:將a[L]-a[R]內的元素都減去P
牛客小白月賽4
sort 暴力 n) b16 黑白 不能 close pla 浮點數 A.三角形 經典暴力:由於不能構成三角形邊長至少乘二,只用考慮最大的log個暴力 1 #include <bits/stdc++.h> 2 using namespace std;
[牛客小白月賽4 H] 相鄰的糖果
感覺 CA long ret inpu -m 執行 情況 scrip Description 有n個盒子擺成一排,每個盒子內都有ai個糖果。 現在你可以執行以下操作: ·你可以選擇任意一個盒子,在選擇的盒子內吃掉一個糖果。 對你的要求如下: ·任何m個相鄰的盒子內糖果數量不
牛客小白月賽4-E-浮點數輸出 字符串
bsp 小白 clas spa DC HA \n pan main 1 #include <bits/stdc++.h> 2 int main() 3 { 4 char a[1000]; 5 scanf("%s",a); 6 pri
牛客小白月賽4 A 三角形
() ont OS namespace 一個 分類 代碼簡潔 include str 題解+AC代碼 首先將木棍按長度排序,可以確定的是可以組成的最大三角形的三根木棍就是連著的三個如果偷走的木棍不是這三根木棍中的其中一個,那麽答案顯然,否則分類處理一下。 #inclu
牛客小白月賽5 I - 區間
poj amp using data cli oar += 一行 cst 看到一份不錯的操作。。。。。 鏈接:https://www.nowcoder.com/acm/contest/135/I 來源:牛客網 Apojacsleam喜歡數組。 他現在有
牛客小白月賽2 G 文 【模擬】
algo 思路 大小 cstring 字符 20M 所有 desc ans 鏈接:https://www.nowcoder.com/acm/contest/86/G來源:牛客網 題目描述 Sεlιнα(Selina) 開始了新一輪的男友海選。她要求她的男友要德