結果

問題 No.51 やる気の問題
ユーザー derui
提出日時 2016-07-16 17:13:41
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 14,904 ms
コンパイル使用メモリ 222,548 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 13:48:58
合計ジャッジ時間 15,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

package main
import "fmt"

func main() {
	var work, limit int
	fmt.Scanf("%d", &work)
	fmt.Scanf("%d", &limit)

	fmt.Println(solve(work, limit))
}

func solve(work int, limit int) int {
	current := limit
	restWork := work
	
	for current > 1 {
		todayWork := current * current
		current = current - 1
		
		if todayWork > restWork {
			continue
		}

		restWork = restWork - (restWork / todayWork)
	}

	return restWork
}
0