結果

問題 No.2063 ±2^k operations (easy)
ユーザー iwot
提出日時 2022-09-08 13:49:34
言語 PHP
(843.2)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 3,025 ms
コンパイル使用メモリ 31,892 KB
実行使用メモリ 31,512 KB
最終ジャッジ日時 2024-11-24 07:21:28
合計ジャッジ時間 3,371 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$n = fgets(STDIN);

$len = strlen($n);
$cnt = 0;
$yes = true;
for ($i=0; $i<$len; $i++) {
    if ($n[$i] == '1') {
        $cnt++;
    }
    if ($i > 0 && $yes && ($n[$i-1] == '0' && $n[$i] == '1')) {
        $yes = false;
    }
}

if ($cnt == 2 || $cnt > 2 && $yes) {
    println('Yes');
} else {
    println('No');
}

function println($output)
{
    echo $output . PHP_EOL;
}
0