多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > URAL 1295. Crazy Notions(數學啊 & 找規律)

URAL 1295. Crazy Notions(數學啊 & 找規律)

來源:程序員人生   發布時間:2015-04-08 08:35:27 閱讀次數:3506次

題目鏈接:http://acm.timus.ru/problem.aspx?space=1&num=1295



1295. Crazy Notions

Time limit: 0.5 second
Memory limit: 64 MB
For five days robot-loader JK546L54p has been buried under the thick layer of the Sibelian plutonium slag. The terrible strike of the atmospheric electricity has led to the depressurization of the robot’s fuel elements. Who will examine this heap of fused, broken metal here, where there is no any robot technician even at distance of a hundred parsecs? Robot-commissar even did not try to investigate what happened with JK546L54p. He ordered to throw him out into dumps and that is all. Nobody noticed that positron brains of JK546L54p were still working. If only the robopsychologist was here with JK546L54p! Of course, he would be killed with the hard gamma radiation in a moment, but… If he attached the visualizer of thoughts to the fused connectors of JK546L54p! He would see the strange performance. Robot was creating! No, I am not joking. He was investigating. Semi casual objects arose in his mind, and he examined them. Crazy properties, crazy theorems.
Besides, here is an example. Let’s take an expression 1n+2n+3n+4n. How much zeros does its decimal notation end with? JK546L54p solved this problem, and you, student, could you?

Input

The only line contains an integer n (1 ≤ n ≤ 300000).

Output

Output the number of zeroes the decimal notation of 1n+2n+3n+4n ends with.

Samples

input output
1
1
3
2



代碼以下(找規律):

#include <cstdio> #define LL __int64 //int main() //{ // int n; // for(int i = 1; i <= 32; i++) // { // LL ans1 = 1; // LL ans2 = 1; // LL ans3 = 1; // LL ans4 = 1; // for(int j = 1; j <= i; j++) // { // ans2*=2; // ans3*=3; // ans4*=4; // } // int cnt = 0; // LL ans = ans1+ans2+ans3+ans4; // while(ans) // { // if(ans%10 == 0) // { // cnt++; // ans/=10; // } // else // { // break; // } // } // printf("%d:: ans:%d ",i,cnt); // } // return 0; //} int main() { int n; int a[30]= {1,1,2,0,2,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0}; while(~scanf("%d",&n)) { printf("%d ",a[(n⑴)%20]); } return 0; // while(~scanf("%d",&n)) // { // if(n%4 == 0) // { // printf("0 "); // } // else if((n%4==1 &&n%5==0) || n%4==3) // { // printf("2 "); // } // else // { // printf("1 "); // } // } return 0; }

貼1發他人的:

#include <stdio.h> #include <iostream> #include <algorithm> using namespace std; long long mod=100000; long long quickmulti(long long m,long long n)//2分快速冪 { long long ans=1; long long i; while(n) { if(n&1) ans=(m*ans)%mod; m=(m*m)%mod; n>>=1; } return ans; } int main() { long long n; while(scanf("%lld",&n)!=EOF) { long long ans=1; ans+=quickmulti(2,n); ans%=mod; ans+=quickmulti(3,n); ans%=mod; ans+=quickmulti(4,n); ans%=mod; long long tem=ans; long long tt=0; while(tem%10==0) { tem/=10; tt++; } printf("%lld ",tt); } return 0; }


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 亚洲激情欧美激情 | 久久v| 欧美日韩中文国产 | 最近的中文字幕视频完整 | 国产一级淫片a视频免费观看 | 午夜秋霞成人理论 | 国产美女啪啪 | 精品一区二区三区免费视频 | 国产精品第44页 | 日本www高清免费视频观看 | 性欧美护士18xxxxhd视频 | 日本在线不卡视频 | 一本到视频在线 | 中文字幕亚洲欧美 | 精品毛片| aⅴ天堂网 | 国产乱辈通伦影片在线播放亚洲 | 久久不色 | 国产福利片在线 | 岛国片欧美一级毛片 | 欧美男男作爱gayxxx | 久久99国产精品一区二区 | 国产亚洲精品资源在线26u | 色老头成人免费视频天天综合 | 在线观看视频一区二区 | 久久国产高清一区二区三区 | 国产精品成人免费福利 | 欧美猛交 | jizz在线观看18 | 亚洲黄网站wwwwww | 亚洲成人免费在线视频 | 在线观看视频网站 | 一本大道加勒比久久 | 免费视频亚洲 | 欧美一级片黄色片 | 国产在线a不卡免费视频 | 国产麻豆视频在线观看 | 国产一区二区三区国产精品 | 久久亚洲国产精品一区二区 | 最近高清中文在线字幕在线观看 | 999精品久久久中文字幕蜜桃 |