結果

問題 No.499 7進数変換
ユーザー Lapis_NU
提出日時 2019-08-25 19:31:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 352 bytes
コンパイル時間 1,493 ms
コンパイル使用メモリ 158,812 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-06 22:40:04
合計ジャッジ時間 2,521 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t n;
  cin>>n;
  if(n==0){
  cout<<0;
  }
  else{
  int a=n;
  int count=0;
  while(a>0){
  a/=7;
  count++;
  }
  vector<int> ans(count);
  for(int i=0;i<count;i++){
    int t=pow(7,count-i-1)/1;
  ans.at(i)+=n/t;
  n=n%t;
  }
  for(int i=0;i<count;i++){
  cout<<ans.at(i);
  }
  }
}
0