ACM简单计算题.pptVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
ACM简单计算题概要1

1021 Fibonacci Again Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n=2). Input Input consists of a sequence of lines, each containing an integer n. (n 1,000,000). Output Print the word yes if 3 divide evenly into F(n). Print the word no if not. Sample input: 0 1 2 3 4 5 6 Sample output: no no yes no no no yes Time Limit: 2000/1000 MS (Java/Others)???? Memory Limit: 65536/32768 K (Java/Others) 题目分析: 能被3整除的整数的特点? 还要看程序吗? 如果两个数的和能被3整除,这两个数有什么特点? 关于能否被3整除,这两个数一共有多少种组合? #includestdio.h int main() { long n; while(scanf(%ld,n) != EOF) if (n%8==2 || n%8==6) printf(yes\n); else printf(no\n); return 0; } /showproblem.php?pid=1061 Rightmost Digit Problem Description Given a positive integer N, you should output the most right digit of N^N. Input The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.Each test case contains a single positive integer N(1=N=1,000,000,000). Output For each test case, you should output the rightmost digit of N^N. Sample input: 2 3 4 Sample output: 7 6 数据规模? 很大 暴力方法? 该打 基本思路? 规律 #includestdio.h main() {int T,i,a,digit; long n; scanf(%d,T); for(i=0;iT;i++) {scanf(%ld,n); ? a=n%10; if(a==0||a==1||a==6||a==9||a==5) ? ? ? digit=a; else if(a==4) ? ? ? digit=6; else if(a==2) ? ? ? {if(n%4==0) digit=6; ? ? ? else digit=4;} else if(a==3) ? ? ? {if(n%4==1) digit=3; ? ? ? else digit=7;} ?else if(a==7) ? ? ? {if(n%4==1) digit=7; ? ? ? else digit=3;} ?else ? ? ? {if(n%4==0) digit=6; ? ? ? else digit=4;} printf(%d\n,digit);}} 人见人爱A^B 求A^B的最后三位数表示的整数(1=A,B=10000) 2 3 12 6 8 984 HDOJ_2035 人见人爱A^B 最暴力的暴力? 改进的暴力? 还有规律么? #includestdio.h int main() { ? ? int a,b,i,a0,m; ? ? while(scanf(%d%d,a,b)!=EOF (a!=0 || b!=0)) ? ? { ? ? ? ? a0=a=a%1000; ? ? ? ? for(i=2;i=b;i++) ? ? ? ? { ? ? ? ? ? ? m=a0*a; ? ? ?

文档评论(0)

yaocen + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档