結果
問題 |
No.546 オンリー・ワン
|
ユーザー |
![]() |
提出日時 | 2025-05-18 22:19:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 396 bytes |
コンパイル時間 | 2,137 ms |
コンパイル使用メモリ | 191,240 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-18 22:19:11 |
合計ジャッジ時間 | 2,948 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | freopen("onlyone.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:7:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | freopen("onlyone.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:9:35: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | for(int i=1;i<=n;i++)scanf("%lld",&c[i]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; int n,l,r,c[1234567],ans; signed main(){ freopen("onlyone.in","r",stdin); freopen("onlyone.out","w",stdout); cin>>n>>l>>r; for(int i=1;i<=n;i++)scanf("%lld",&c[i]); for(int i=l;i<=r;i++){ int cnt=0; for(int j=1;j<=n;j++){ if(i%c[j]==0)cnt++; if(cnt>1)break; } if(cnt==1)ans++; } cout<<ans<<endl; return 0; }