結果

問題 No.544 Delete 7
ユーザー Ronlynes
提出日時 2017-07-15 16:35:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 639 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 61,276 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 16:17:41
合計ジャッジ時間 2,136 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 45 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:11: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |         a += pow(10, ans[i]);
      |         ~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
#define MAX 1000000000

using namespace std;

bool check(long long x){
    string s = to_string(x);
    for(int i=0; i<s.length(); i++){
        if(s[i] == '7'){
            return false;
        } 
    }
    return true;
}
int main(void){
    long long n, a, b;
    int ans[1000], cnt=0;
    cin >> n;
    string s = to_string(n);
    for(int i=0; i<s.length(); i++){
        if(s[i] == '7'){
            ans[cnt++] = s.length() - 1 - i;
        }
    }
    for(int i=0;i<cnt;i++){
        a += pow(10, ans[i]);
    }
    b = n - a;
    cout << a << " " << b << endl;
    return 0;
}
0