結果

問題 No.782 マイナス進数
ユーザー kotatsugame
提出日時 2019-01-27 15:43:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 225 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 64,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 17:42:37
合計ジャッジ時間 3,280 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int t,b;
void f(int n)
{
	if(!n)return;
	f(n>0?-(n/-b):(-n-b-1)/-b);
	cout<<(n>0?n%-b:(-b-(-n%-b?-n%-b:-b)));
}
main()
{
	cin>>t>>b;
	for(;t--;)
	{
		int n;cin>>n;f(n);cout<<endl;
	}
}
0