結果
| 問題 |
No.784 「,(カンマ)」
|
| コンテスト | |
| ユーザー |
addeight2
|
| 提出日時 | 2019-02-09 13:34:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 355 bytes |
| コンパイル時間 | 1,832 ms |
| コンパイル使用メモリ | 159,880 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 19:07:30 |
| 合計ジャッジ時間 | 2,457 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 2 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=]
10 | scanf("%I64d",&N);
| ~~~~^ ~~
| | |
| | ll* {aka long long int*}
| int*
| %I64lld
main.cpp:17:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type’ {aka ‘long long int’} [-Wformat=]
17 | printf("%I64d",ans[(int)ans.size()-1-i]);
| ~~~~^
| |
| int
| %I64lld
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%I64d",&N);
| ~~~~~^~~~~~~~~~~~
ソースコード
#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("%I64d",&N);
while(N>0){
ans.push_back(N%1000);
N/=1000;
}
REP(i,(int)ans.size()){
if(i)cout<<',';
printf("%I64d",ans[(int)ans.size()-1-i]);
}
printf("\n");
}
addeight2