結果
| 問題 | No.544 Delete 7 |
| コンテスト | |
| ユーザー |
Ronlynes
|
| 提出日時 | 2017-07-15 16:35:19 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 639 bytes |
| 記録 | |
| コンパイル時間 | 459 ms |
| コンパイル使用メモリ | 80,000 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-15 19:48:29 |
| 合計ジャッジ時間 | 2,161 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 48 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:11: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
28 | a += pow(10, ans[i]);
| ~~^~~~~~~~~~~~~~~~~~
main.cpp:18:18: note: 'a' was declared here
18 | long long n, a, b;
| ^
ソースコード
#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;
}
Ronlynes