結果
| 問題 | 
                            No.2534 コラッツ数列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ID 21712
                         | 
                    
| 提出日時 | 2025-02-20 23:09:04 | 
| 言語 | Go  (1.23.4)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 472 bytes | 
| コンパイル時間 | 16,907 ms | 
| コンパイル使用メモリ | 252,692 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2025-02-20 23:09:22 | 
| 合計ジャッジ時間 | 16,378 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
package main
import . "fmt"
func main() {
	var n int64
	Scan(&n)
	op,steps:=1,0
	var x int64
	for {
		if steps >50 {
			Println("No")
			return
		}
		switch op {
		case 1:
			steps++
			x=n
			op++
		case 2:
			steps++
			if x==1 {
				op=4
			} else {
				op++
			}
		case 3:
			steps++
			if x%2==0 {
				x/=2
			} else {
				x=3*x+1
			}
			op=2
		case 4:
			if steps<=50 {
				Println("Yes")
				Println(steps)
			} else {
				Println("No")
			}
			return
		}
	}
	
}
            
            
            
        
            
ID 21712