結果
| 問題 | No.1486 ロボット |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-23 21:26:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 716 bytes |
| 記録 | |
| コンパイル時間 | 1,901 ms |
| コンパイル使用メモリ | 191,420 KB |
| 最終ジャッジ日時 | 2025-01-20 23:32:56 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]
25 | printf("%lld\n", ans);
| ~~~^ ~~~
| | |
| | int
| long long int
| %d
main.cpp:18:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;
template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
int main() {
int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
int A = a + b, B = c + d, C = std::lcm(A, B), ans = 0;
for(int i = 0; i < C; i++) if((i % A < a) and (i % B < c)) ans++;
ans *= e / C;
for(int i = 0; i < e % C; i++) if((i % A < a) and (i % B < c)) ans++;
printf("%lld\n", ans);
return 0;
}