結果
| 問題 | 
                            No.713 素数の和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-09-21 15:30:41 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 323 bytes | 
| コンパイル時間 | 112 ms | 
| コンパイル使用メモリ | 22,912 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-18 08:41:51 | 
| 合計ジャッジ時間 | 596 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
            
            ソースコード
#include <stdio.h>
bool isprime(int n) {
    for (int i = 2; i*i <= n; i++)
        if (n%i == 0)
            return false;
    return true;
}
int main() {
    int n;
    scanf("%d", &n);
    int sum = 0;
    for (int i = 2; i <= n; i++)
        if (isprime(i))
            sum+=i;
    printf("%d\b", sum);
    return 0;
}