关于c 语言编程的一道题The 3n + 1 problem ITime Limit:1000ms Memory Limit:65536KTotal Submissions:393 Accepted:183DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g.,NP,Unsolvable,Re

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/10 09:54:24
关于c 语言编程的一道题The 3n + 1 problem ITime Limit:1000ms Memory Limit:65536KTotal Submissions:393 Accepted:183DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g.,NP,Unsolvable,Re

关于c 语言编程的一道题The 3n + 1 problem ITime Limit:1000ms Memory Limit:65536KTotal Submissions:393 Accepted:183DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g.,NP,Unsolvable,Re
关于c 语言编程的一道题
The 3n + 1 problem I
Time Limit:1000ms Memory Limit:65536K
Total Submissions:393 Accepted:183
Description
Problems in Computer Science are often classified as belonging to a certain class of problems (e.g.,NP,Unsolvable,Recursive).In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs.Consider the following algorithm:
\x05\x051.\x05\x05 input n
\x05\x052.\x05\x05 print n
\x05\x053.\x05\x05 if n = 1 then STOP
\x05\x054.\x05\x05 \x05\x05 if n is odd then n

关于c 语言编程的一道题The 3n + 1 problem ITime Limit:1000ms Memory Limit:65536KTotal Submissions:393 Accepted:183DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g.,NP,Unsolvable,Re
#include
int main()
{
int n,i,j,a[3];
\x05for(i=0;i