結果
問題 | No.499 7進数変換 |
ユーザー | 777yuuki12323 |
提出日時 | 2017-04-07 23:07:40 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 61,168 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-16 02:55:22 |
合計ジャッジ時間 | 1,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:33:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 33 | printf("%d", N/num); | ~^ ~~~~~ | | | | int ll {aka long long int} | %lld
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <map> typedef long long ll; #define fi first #define se second using namespace std; ll N; ll num; int main(){ cin>>N; num = 1; int cnt = 0; int i; if( N ){ while( N > num ){ num *= 7; } while( num ){ if( cnt || N/num ){ printf("%d", N/num); cnt++; } N %= num; num /= 7; } } else{ printf("0"); } puts(""); return 0; }