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第三次课件

* * 第一类 技 巧 型 * * 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 ? Sample Output no no yes no no no * * * * 题目分析: 判断某一项是否能被3 整除 是否需要把某一项的值求出来,进行整除判断? 能被3整除的整数的特点? 关于能否被3整除,这样的项在排列上是否有规律? (找出规律) 第0项除以3余1,第1项除以3余2,第2项整除, 第3项除以3余2,第4项除以3余2,第5项除以3余1, 第6项整除,第7项除以3余1,第8项除以3余1, 第9项除以3余2,第7项整除……. * * 题目分析: 能被3整除的整数的特点? 如果两个数的和能被3整除,这两个数有什么特点? 关于能否被3整除,这两个数一共有多少种组合? * * Hdoj_1021程序清单: #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; } * * #include stdio.h int main() { int n; while(scanf(%d, n) !=EOF) { if((n - 2) % 4) printf(no\n); else printf(yes\n); } return 0; } * * #includestdio.h int main() { int F1,F2,i,t; long n; while(scanf(%ld,n)!=EOF) { F1=1; F2=2; for(i=2;i=n;i++) { t=F2; F2=(F1+F2)%3; F1=t; } if(n2) printf(no\n); else if(F2==0) printf(yes\n); else printf(no\n); } return 0; } * * 第二类 基 本 型 * * 1009: FatMouse Trade * * Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain. * * Input The input consists of multiple t

文档评论(0)

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

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

1亿VIP精品文档

相关文档