2019 GDUT 新生專題 B題

2021-10-02 04:56:50 字數 979 閱讀 8380

題目

fedya studies in a gymnasium. fedya』s maths hometask is to calculate the following expression:

for given value of n. fedya managed to complete the task. can you? note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).

input

the single line contains a single integer n (0 ≤ n ≤ 10^100000). the number doesn』t contain any leading zeroes.

output

print the value of the expression without leading zeros.

examples

input

4output

4input

124356983594583453458888889

output

0思路:本來第一眼看了,n很大,要用快速冪來做,但是在紙上寫了幾個例子之後,發現n=0時,結果是4,n=1,2,3,結果是0,n=4時結果是4,n=5,6,7,結果是0,n=8時結果時4,依次類推,可以知道這是有規律的,n%4=0時,結果是4,其餘結果0.

**

#include #include char n[100005]; 

int func()

return res;

}int main()

2019 GDUT新生專題 C題

題目 1967年,美國著名的社會學家斯坦利 公尺爾格蘭姆提出了乙個名為 小世界現象 small world phenomenon 的著名假說,大意是說,任何2個素不相識的人中間最多隻隔著6個人,即只用6個人就可以將他們聯絡在一起,因此他的理論也被稱為 六度分離 理論 six degrees of s...

2019 GDUT新生專題 J題

某省自從實行了很多年的暢通工程計畫後,終於修建了很多路。不過路多了也不好,每次要從乙個城鎮到另乙個城鎮時,都有許多種道路方案可以選擇,而某些方案要比另一些方案行走的距離要短很多。這讓行人很困擾。現在,已知起點和終點,請你計算出要從起點到終點,最短需要行走多少距離。input 本題目包含多組資料,請處...

2019 GDUT 新生專題 K題

題目鏈結 題目大意 計算連通的最短路線的花費,但是要滿足兩點之間距離不小於10和不大於1000,如果不能連通,就輸出oh!能就輸出最少花費。思路 最小生成樹問題,不過不是直接套prim模板了,做些小修改,詳情看 include include include using namespace std ...