結果
問題 | No.1047 Zero (Novice) |
ユーザー |
![]() |
提出日時 | 2020-05-08 21:54:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 73,532 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 00:33:55 |
合計ジャッジ時間 | 1,243 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream>#include <vector>#include<map>#include<string>#include<algorithm>#include<sstream>using namespace std;int main() {int a,b;cin >> a>>b;int n=0;int count=0;bool flag = false;bool flag2 = true;if (a == -1 || b == 0) {while (n != 0||flag2) {flag2 = false;n = a * n + b;count++;}flag = true;}if (flag) {cout << count;}else {cout << -1;}}