結果
| 問題 | No.2545 Divide by 3 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-11 10:59:21 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 981 bytes | 
| コンパイル時間 | 12,855 ms | 
| コンパイル使用メモリ | 386,648 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-27 04:25:55 | 
| 合計ジャッジ時間 | 13,631 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 5 | 
ソースコード
// https://yukicoder.me/problems/no/2545 (3.5)
// https://nu50218.dev/posts/integer-division-by-multiplication/ の議論を使うことで、
// (x * 0x5555_5556) >> 32 が答えであることがわかる。
// x * 0x5555_5556 は常に 2^62 以下であるため問題ない。
fn main() {
    println!("67");
    // A[4] = 5x
    println!("plus 5 1 1");
    println!("plus 5 5 5");
    println!("plus 4 1 5");
    // A[4] = 0x55 * x
    println!("plus 4 5 5");
    println!("plus 5 5 5");
    println!("plus 5 5 5");
    println!("plus 5 5 5");
    println!("plus 4 4 5");
    // A[4] = 0x5555 * x
    println!("plus 4 5 5");
    for _ in 1..8 {
        println!("plus 5 5 5");
    }
    println!("plus 4 4 5");
    // A[4] = 0x55555555 * x
    println!("plus 4 5 5");
    for _ in 1..16 {
        println!("plus 5 5 5");
    }
    println!("plus 4 4 5");
    // A[3] = 0x55555556 * x
    println!("plus 3 4 1");
    for _ in 0..32 {
        println!("div 3 3");
    }
}
            
            
            
        