关于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/12/20 00:27:17
关于c语言编程的一道题The3n+1problemITimeLimit:1000msMemoryLimit:65536KTotalSubmissions:393Accepted:183Descript

关于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