結果
| 問題 |
No.810 割った余りの個数
|
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-08-30 14:42:20 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 418 bytes |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 31,872 KB |
| 実行使用メモリ | 784,980 KB |
| 最終ジャッジ日時 | 2024-11-21 08:13:08 |
| 合計ジャッジ時間 | 37,066 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 8 MLE * 6 |
コンパイルメッセージ
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++)
| ~^~~~~~~~~~
ソースコード
#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);
}
funakoshi