UVaOJ 694 - The Collatz Sequence
来源:互联网 发布:mac 连接云服务器 编辑:程序博客网 时间:2024/05/20 09:09
//题目明明告诉了我数据范围了,我还是没有注意溢出的问题!啊//要用long,甚至long long#include <stdio.h>int main(){long long A = -1;long long limit = -1;int n = 0;while (~scanf("%lld%lld", &A, &limit) && !(A == -1 && limit == -1)){++n;printf("Case %d: A = %lld, limit = %lld, number of terms = ", n, A, limit);int count = 0;while (A != 1 && A <= limit){if (A % 2 == 0)A /= 2;elseA = A * 3 + 1;++count;}if (A == 1)++count;printf("%d\n", count);}return 0;}
0 0
- uvaoj 694 - The Collatz Sequence
- UVaOJ 694 - The Collatz Sequence
- UVaOJ 694 - The Collatz Sequence
- UVaOJ 694 The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- 694 - The Collatz Sequence
- UVa 694 - The Collatz Sequence
- uva-694 - The Collatz Sequence
- UVa 694 The Collatz Sequence
- UVA 694 - The Collatz Sequence
- UVA 694 - The Collatz Sequence
- UVa 694 - The Collatz Sequence
- 数据结构链表自测题——2014-5-5
- http详解
- Trie树基本概念和训练指南
- B. Prison Transfer
- Python中使用Threads和Queue给tornado添加客户端
- UVaOJ 694 - The Collatz Sequence
- Mysql导入数据库及表结构和数据在cmd中
- 为什么以太网最小帧长为64字节
- C++学习总结——类和对象、构造函数和拷贝构造函数
- 程序员为什么要加班
- Skynet协同模型
- 关于c语言链表的操作
- javascript笔记-----------js闭包
- googiehost免费空间申请