結果

問題 No.784 「,(カンマ)」
ユーザー addeight2
提出日時 2019-02-09 13:42:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 1,279 ms
コンパイル使用メモリ 159,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 19:07:52
合計ジャッジ時間 1,875 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%lld",&N);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
vector<ll> ans;
int main(){
	ll N;
	scanf("%lld",&N);
	if(N==0){
		ans.push_back(0);
	}
	while(N>0){
		ans.push_back(N%1000);
		N/=1000;
	}
	REP(i,(int)ans.size()){
		if(i)printf(",");
		printf("%lld",ans[(int)ans.size()-1-i]);
	}
	printf("\n");
}
0