算法實(shí)現(xiàn)題1-2 連續(xù)和問題 « 問題描述: 給定一個正整數(shù)n,計(jì)算有多少個不同的連續(xù)自然數(shù)段,其和恰為n。例如,當(dāng)n=27 時(shí),有4 個不同的連續(xù)自然數(shù)段的和恰為27:2+3+4+5+6+7;8+9+10;13+14;27。 « 編程任務(wù): 給定一個正整數(shù)n,試設(shè)計(jì)一個O(n)時(shí)間算法,計(jì)算有多少個不同的連續(xù)自然數(shù)段的 和恰為n。 « 數(shù)據(jù)輸入: 由文件input.txt提供輸入數(shù)據(jù)。文件的第1 行是正整數(shù)n。 « 結(jié)果輸出: 程序運(yùn)行結(jié)束時(shí),將計(jì)算出的和恰為n的連續(xù)自然數(shù)段的個數(shù)輸出到output.txt中。 輸入文件示例 輸出文件示例 input.txt 27 output.txt 4
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶:
資源簡介:
上傳時(shí)間:
上傳用戶: