結果

問題 No.634 硬貨の枚数1
ユーザー 👑 kmjpkmjp
提出日時 2018-01-19 22:22:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 1,296 ms
コンパイル使用メモリ 149,420 KB
実行使用メモリ 478,832 KB
最終ジャッジ日時 2023-08-26 18:45:54
合計ジャッジ時間 20,646 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
478,532 KB
testcase_01 AC 207 ms
478,660 KB
testcase_02 AC 201 ms
478,708 KB
testcase_03 AC 203 ms
478,580 KB
testcase_04 AC 202 ms
478,660 KB
testcase_05 AC 201 ms
478,520 KB
testcase_06 AC 200 ms
478,584 KB
testcase_07 AC 201 ms
478,580 KB
testcase_08 AC 199 ms
478,576 KB
testcase_09 AC 198 ms
478,512 KB
testcase_10 AC 198 ms
478,580 KB
testcase_11 AC 200 ms
478,492 KB
testcase_12 AC 200 ms
478,492 KB
testcase_13 AC 201 ms
478,580 KB
testcase_14 AC 200 ms
478,516 KB
testcase_15 AC 203 ms
478,512 KB
testcase_16 AC 201 ms
478,588 KB
testcase_17 AC 201 ms
478,520 KB
testcase_18 AC 200 ms
478,512 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 201 ms
478,600 KB
testcase_22 AC 201 ms
478,700 KB
testcase_23 AC 203 ms
478,576 KB
testcase_24 AC 201 ms
478,516 KB
testcase_25 AC 203 ms
478,640 KB
testcase_26 AC 204 ms
478,580 KB
testcase_27 AC 204 ms
478,644 KB
testcase_28 AC 206 ms
478,588 KB
testcase_29 AC 201 ms
478,636 KB
testcase_30 AC 200 ms
478,536 KB
testcase_31 AC 204 ms
478,520 KB
testcase_32 AC 201 ms
478,516 KB
testcase_33 AC 200 ms
478,492 KB
testcase_34 AC 202 ms
478,792 KB
testcase_35 AC 203 ms
478,496 KB
testcase_36 AC 201 ms
478,636 KB
testcase_37 AC 205 ms
478,512 KB
testcase_38 AC 201 ms
478,584 KB
testcase_39 AC 203 ms
478,512 KB
testcase_40 AC 202 ms
478,652 KB
testcase_41 AC 201 ms
478,520 KB
testcase_42 AC 201 ms
478,516 KB
testcase_43 AC 202 ms
478,728 KB
testcase_44 AC 204 ms
478,832 KB
testcase_45 AC 203 ms
478,512 KB
testcase_46 AC 203 ms
478,492 KB
testcase_47 WA -
testcase_48 AC 200 ms
478,796 KB
testcase_49 AC 202 ms
478,508 KB
testcase_50 AC 203 ms
478,516 KB
testcase_51 AC 201 ms
478,792 KB
testcase_52 AC 199 ms
478,516 KB
testcase_53 AC 199 ms
478,704 KB
testcase_54 AC 199 ms
478,592 KB
testcase_55 AC 202 ms
478,648 KB
testcase_56 AC 204 ms
478,808 KB
testcase_57 AC 203 ms
478,688 KB
testcase_58 AC 206 ms
478,512 KB
testcase_59 AC 204 ms
478,512 KB
testcase_60 AC 205 ms
478,600 KB
testcase_61 AC 203 ms
478,732 KB
testcase_62 AC 204 ms
478,492 KB
testcase_63 AC 202 ms
478,584 KB
testcase_64 AC 202 ms
478,636 KB
testcase_65 AC 201 ms
478,524 KB
testcase_66 AC 202 ms
478,596 KB
testcase_67 AC 205 ms
478,516 KB
testcase_68 AC 203 ms
478,580 KB
testcase_69 AC 204 ms
478,580 KB
testcase_70 AC 202 ms
478,576 KB
testcase_71 AC 204 ms
478,492 KB
testcase_72 AC 202 ms
478,596 KB
testcase_73 AC 206 ms
478,652 KB
testcase_74 AC 205 ms
478,584 KB
testcase_75 AC 206 ms
478,516 KB
testcase_76 AC 199 ms
478,508 KB
testcase_77 AC 203 ms
478,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int mi[10101010];
vector<int> V;
map<int,int> M[10101010];

int hoge(int N) {
	int ret=0;
	FORR(c,V) while(N>=c) ret++, N-=c;
	return ret;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	for(i=1;i<=3200;i++) V.push_back(i*(i+1)/2);
	
	cin>>N;
	int ret=10101010;
	FORR(x,V) {
		if(x==N) ret=1;
		FORR(y,V) {
			if(x+y<=N) ret=min(ret,2+(N-x-y));
		}
	}
	if(ret>3) ret=3;
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0