結果
問題 |
No.537 ユーザーID
|
ユーザー |
![]() |
提出日時 | 2017-11-02 00:12:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 651 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 62,508 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-22 14:52:16 |
合計ジャッジ時間 | 1,767 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 32 |
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import <iostream> | ^~~~~~ main.cpp:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 2 | #import <cmath> | ^~~~~~ main.cpp: In function ‘int main()’: main.cpp:39:17: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 39 | cout << x << endl; | ^
ソースコード
#import <iostream> #import <cmath> using namespace std; bool p(const int m, const int n) { const int d1 = m % 10; const int d2 = n % 10; if (d1 != d2) { return false; } const int m_d = floor(log10(m)+1); const int n_d = floor(log10(n)+1); int t1 {0}; int t2 {0}; for (int i = 0; i < m_d; ++i) { t1 += d1 * pow(10, i); } if (m != t1) { return false; } for (int i = 0; i < n_d; ++i) { t2 += d2 * pow(10, i); } if (n != t2) { return false; } return true; } int main() { int n; int x; cin >> n; for (int i = 1; i <= sqrt(n); ++i) { if (n % i == 0) { x += p(i, n/i) || i == sqrt(n) ? 1 : 2; } } cout << x << endl; }