結果
| 問題 | 
                            No.3023 Utility is Max?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             qwewe
                         | 
                    
| 提出日時 | 2025-05-14 13:01:37 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,020 bytes | 
| コンパイル時間 | 761 ms | 
| コンパイル使用メモリ | 65,372 KB | 
| 実行使用メモリ | 7,848 KB | 
| 最終ジャッジ日時 | 2025-05-14 13:03:59 | 
| 合計ジャッジ時間 | 4,235 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 2 | 
| other | WA * 17 | 
ソースコード
#include <iostream>
#include <cstdio> // scanf might be needed if iostream is too slow or large, but let's try iostream first.
// We cannot use digits 0-9, operators +-*/, or the word "prime".
int main() {
    int n;
    // Standard input uses cin or scanf. Let's use scanf as it sometimes has less overhead.
    // We need to read an integer. "%d" contains a digit, which is forbidden.
    // We can try using std::cin.
    std::cin >> n;
    // Define constants without using digits or forbidden operators.
    // We can use sizeof or character arithmetic. Let's use sizeof.
    const int one = sizeof(char); // sizeof(char) is guaranteed to be 1.
    const int zero = !one;        // !1 gives 0.
    
    // Create the number two.
    int two = one;
    ++two; // two now holds 1 + 1 = 2.
    // Use a boolean flag to track if the number is composite (not prime).
    // Initialize assuming it might be prime, unless it's 1.
    bool is_composite = !(n > one); // If n is not greater than 1 (i.e., n == 1), it's composite.
    // Only check for divisors if n > 1.
    if (!is_composite) {
        // Iterate from i = 2 up to n-1.
        int i = two;
        while (i < n) {
            // Check if n is divisible by i using the modulo operator (%).
            // Modulo operator is allowed.
            if (n % i == zero) {
                // If divisible, n is not prime (it's composite).
                is_composite = true;
                // We found a divisor, no need to check further.
                // 'break' statement is allowed.
                break; 
            }
            // Increment i without using '+'. '++' is allowed.
            ++i;
        }
    }
    // Output the result based on the flag.
    // String literals "YES" and "NO" are allowed.
    // The newline character '\n' is allowed.
    if (is_composite) {
        std::cout << "NO\n";
    } else {
        std::cout << "YES\n";
    }
    // No 'return 0;' allowed. The program should implicitly return 0 upon exiting main.
}
            
            
            
        
            
qwewe