結果
| 問題 | No.51 やる気の問題 | 
| コンテスト | |
| ユーザー |  184 | 
| 提出日時 | 2014-10-28 23:34:43 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 5,000 ms | 
| コード長 | 357 bytes | 
| コンパイル時間 | 456 ms | 
| コンパイル使用メモリ | 39,552 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-30 14:23:22 | 
| 合計ジャッジ時間 | 1,608 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   19 |         printf("%d\n",ans);
      |                 ~^    ~~~
      |                  |    |
      |                  int  long long int
      |                 %lld
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%lld%lld",&w,&d);//%d%d%d%d",&n,&v,&x,&y,&ax,&ay);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
//namaega 184
int main(){ 
	long long d,w;
	scanf("%lld%lld",&w,&d);//%d%d%d%d",&n,&v,&x,&y,&ax,&ay);
	long long ans=0;
	while(d){
		ans=w/(d*d);
		if(d==1)break;
		w-=ans;
		d--; 
	}
	printf("%d\n",ans);
	return 0;
}
            
            
            
        