結果
| 問題 | No.1486 ロボット | 
| コンテスト | |
| ユーザー |  pengin_2000 | 
| 提出日時 | 2021-07-16 16:10:15 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 560 bytes | 
| コンパイル時間 | 1,112 ms | 
| コンパイル使用メモリ | 29,312 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-06 03:20:08 | 
| 合計ジャッジ時間 | 2,240 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 WA * 9 RE * 1 | 
ソースコード
#include<stdio.h>
int gcd(int a, int b)
{
	int r = a % b;
	while (r > 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
int main()
{
	int a, b, c, d, e;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
	int l = (a + c) / gcd(a + b, c + d) * (c + d);
	int i, cnt = 0;
	for (i = 1; i <= l; i++)
		if (1 <= i % (a + b) && i % (a + b) <= a && 1 <= i % (c + d) && i % (c + d) <= c)
			cnt++;
	cnt *= e / l;
	for (i = 1; i <= e % l; i++)
		if (1 <= i % (a + b) && i % (a + b) <= a && 1 <= i % (c + d) && i % (c + d) <= c)
			cnt++;
	printf("%d\n", cnt);
	return 0;
}
            
            
            
        