結果

問題 No.810 割った余りの個数
ユーザー funakoshifunakoshi
提出日時 2019-08-30 14:42:20
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 418 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 392,524 KB
最終ジャッジ日時 2024-05-01 06:21:41
合計ジャッジ時間 12,590 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
392,428 KB
testcase_01 AC 132 ms
392,356 KB
testcase_02 AC 138 ms
392,320 KB
testcase_03 AC 133 ms
392,420 KB
testcase_04 AC 133 ms
392,408 KB
testcase_05 AC 136 ms
392,408 KB
testcase_06 AC 132 ms
392,512 KB
testcase_07 AC 132 ms
392,512 KB
testcase_08 AC 134 ms
392,360 KB
testcase_09 AC 134 ms
392,436 KB
testcase_10 AC 134 ms
392,496 KB
testcase_11 AC 133 ms
392,436 KB
testcase_12 AC 131 ms
392,480 KB
testcase_13 AC 131 ms
392,424 KB
testcase_14 AC 131 ms
392,408 KB
testcase_15 AC 132 ms
392,440 KB
testcase_16 AC 133 ms
392,516 KB
testcase_17 AC 131 ms
392,440 KB
testcase_18 AC 133 ms
392,416 KB
testcase_19 AC 133 ms
392,428 KB
testcase_20 AC 1,001 ms
392,524 KB
testcase_21 TLE -
testcase_22 AC 419 ms
392,520 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:18:18: warning: iteration 99999999 invokes undefined behavior [-Waggressive-loop-optimizations]
   18 |         if(modcnt[i]>0)
      |            ~~~~~~^~~
main.c:16:18: note: within this loop
   16 |     for(int i=0;i<100000000;i++)
      |                 ~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    int l,r,m,cnt=0;
    int modcnt[99999999]={0};
    scanf("%d %d %d",&l,&r,&m);
    for(int i=l;i<=r;i++)
    {
        int ans = i%m;
        modcnt[ans]++;
    }
    for(int i=0;i<100000000;i++)
    {
        if(modcnt[i]>0)
        {
            cnt++;
        }
    }
    printf("%d",cnt);
}
    
0