結果

問題 No.207 世界のなんとか
ユーザー projectappbird
提出日時 2019-07-25 14:30:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 578 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 78,816 KB
最終ジャッジ日時 2025-01-07 07:29:16
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
bool check3(unsigned long* num,const unsigned int start,const unsigned int end = 0);
int main(){
    unsigned long a;
    unsigned long b;
    cin >> a >> b;
    for (;a<=b;a++){
      if (!(a%3) || check3(&a,1)) cout << a << endl;
    }
    
}
inline bool check3(unsigned long* num,const unsigned int start,const unsigned int end){
 
 for (unsigned int d = start; d <= ((end) ? end : floor(log10(*num)) + 1); d++){
  if ( 3 == floor(*num/pow(10,d-1)) - floor(*num/pow(10,d))*10) return true;
 }   
 
    return false;
}
0