結果

問題 No.51 やる気の問題
コンテスト
ユーザー derui
提出日時 2016-07-16 17:13:41
言語 Go
(1.27.0 + ACL)
コンパイル:
/usr/bin/go_c
実行:
./Main
結果
AC  
実行時間 1 ms / 5,000 ms
+ 327µs
コード長 418 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 13,834 ms
コンパイル使用メモリ 262,908 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-18 09:28:46
合計ジャッジ時間 15,920 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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