結果

問題 No.51 やる気の問題
ユーザー Torin3600
提出日時 2017-05-05 22:31:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 281 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 55,916 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 08:50:40
合計ジャッジ時間 4,255 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 2
other RE * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In member function ‘int ld::ldc(int, int)’:
main.cpp:12:20: warning: control reaches end of non-void function [-Wreturn-type]
   12 |                 ldc(w-int((w/(d*d))),d-1);
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
using namespace std;

class ld{
	public:
	int ldc(int w,int d);
};
int ld::ldc(int w,int d){
	if(d==1){
		return  int((w/d*d));
	}else{
		ldc(w-int((w/(d*d))),d-1);
		}
}

int main() {
	ld l;
	int w,d=0;
	cin >> w >> d;
	cout << l.ldc(w,d) << endl;
	return 0;
}
0