結果

問題 No.51 やる気の問題
コンテスト
ユーザー derui
提出日時 2016-07-16 17:13:41
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 418 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11,786 ms
コンパイル使用メモリ 294,244 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-04 15:38:22
合計ジャッジ時間 15,617 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_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