結果

問題 No.1185 完全な3の倍数
ユーザー hangin-svg
提出日時 2021-06-10 05:08:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 166,676 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-29 08:36:12
合計ジャッジ時間 2,663 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 24 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){

  int n;
  cin >> n;
  int i=0,j = n,l=j*10;
  while(j>9) {
    i++;
    j/=10;
    l/=10;
  }
  l%=10;
  
  //cout << n << ' ' << i << ' ' << j << ' ' << l << endl;
  int count;
  if(j==9) count =4;
  else if(j>=6) count = 3;
  else if(j>=3) count = 2;
  else count = 1;
  
  for(int k=0; k<i; k++) count *=4;
  //cout << count << endl;

  if(i>=1) count -= 4;
  else count=0;
  //cout << count << endl;

  int lim = min(n,99);
  for(int k=10; k<=lim; ++k) {
    if((k/10)%3!=0 && k%3==0 ) count ++;
  }

  cout << count << endl;
}
0