{"id":918,"date":"2025-02-28T15:34:20","date_gmt":"2025-02-28T07:34:20","guid":{"rendered":"http:\/\/www.vlab.cn\/main\/?p=918"},"modified":"2025-02-28T15:34:21","modified_gmt":"2025-02-28T07:34:21","slug":"web","status":"publish","type":"post","link":"http:\/\/www.vlab.cn\/main\/index.php\/918.html","title":{"rendered":"web"},"content":{"rendered":"<p><?php\n\/\/ \u6a21\u62df8086\u5bc4\u5b58\u5668\u521d\u59cb\u5316\uff08\u53c2\u8003\u7f51\u98752\u7684\u5bc4\u5b58\u5668\u64cd\u4f5c\u903b\u8f91\uff09\n$AX = 0;   \/\/ \u7d2f\u52a0\u5668\n$BX = 1;   \/\/ \u5f53\u524d\u52a0\u6570\n$CX = 100; \/\/ \u5faa\u73af\u8ba1\u6570\u5668\n$step_log = []; \/\/ \u6b65\u9aa4\u65e5\u5fd7\uff08\u589e\u5f3a\u53ef\u89c6\u5316\uff09\n\n\/\/ \u5faa\u73af\u7d2f\u52a0\u5b9e\u73b0\uff08\u4f18\u5316\u5faa\u73af\u6b21\u6570\uff0c\u53c2\u8003\u7f51\u98751\u7684\u5faa\u73af\u4f18\u5316\u601d\u8def\uff09\nfor ($i = 1; $i <= 100; $i++) {\n    $AX += $BX;        \/\/ ADD AX,BX\n    $current_CX = $CX - $i + 1; \/\/ \u6a21\u62dfLOOP\u6307\u4ee4\u7684\u8ba1\u6570\u5668\u9012\u51cf\n    \n    \/\/ \u8bb0\u5f55\u5bc4\u5b58\u5668\u72b6\u6001\uff08\u5b9e\u73b0\u7f51\u98753\u7684\u52a8\u6001\u53ef\u89c6\u5316\u7406\u5ff5\uff09\n    $step_log[] = [\n        'step' => $i,<br \/>\n        &#8216;AX&#8217; => $AX,<br \/>\n        &#8216;BX&#8217; => $BX,<br \/>\n        &#8216;CX&#8217; => $current_CX,<br \/>\n        &#8216;flags&#8217; => [<br \/>\n            &#8216;ZF&#8217; => ($AX == 0) ? 1 : 0,<br \/>\n            &#8216;CF&#8217; => ($AX > 65535) ? 1 : 0 \/\/ \u6a21\u62df16\u4f4d\u6ea2\u51fa<br \/>\n        ]<br \/>\n    ];<\/p>\n<p>    $BX++; \/\/ INC BX<br \/>\n}<br \/>\n?><\/p>\n<p><!DOCTYPE html><br \/>\n<!-- \u53ef\u89c6\u5316\u8f93\u51fa\uff08\u7ed3\u5408\u7f51\u98753\u7684\u4ea4\u4e92\u5f0f\u6559\u5b66\u7406\u5ff5\uff09 --><br \/>\n<html><br \/>\n<head><\/p>\n<style>\n        .register-table { border-collapse: collapse; margin: 20px }\n        .register-table td, .register-table th { \n            border: 1px solid #ddd; \n            padding: 8px;\n            text-align: center \n        }\n        .flag-cell { background: #f0f0f0 }\n    <\/style>\n<p><\/head><br \/>\n<body><\/p>\n<h3>\u7d2f\u52a0\u8fc7\u7a0b\u8ffd\u8e2a\uff081+2+&#8230;+100\uff09<\/h3>\n<table class=\"register-table\">\n<tr>\n<th>\u6b65\u9aa4<\/th>\n<th>AX(\u7d2f\u52a0\u548c)<\/th>\n<th>BX(\u5f53\u524d\u6570)<\/th>\n<th>CX(\u5269\u4f59\u5faa\u73af)<\/th>\n<th class=\"flag-cell\">ZF\u6807\u5fd7\u4f4d<\/th>\n<th class=\"flag-cell\">CF\u6807\u5fd7\u4f4d<\/th>\n<\/tr>\n<p>        <?php foreach ($step_log as $step): ?><\/p>\n<tr>\n<td><?= $step['step'] ?><\/td>\n<td><?= $step['AX'] ?><\/td>\n<td><?= $step['BX'] ?><\/td>\n<td><?= $step['CX'] ?><\/td>\n<td class=\"flag-cell\"><?= $step['flags']['ZF'] ?><\/td>\n<td class=\"flag-cell\"><?= $step['flags']['CF'] ?><\/td>\n<\/tr>\n<p>        <?php endforeach ?><br \/>\n    <\/table>\n<h4>\u6700\u7ec8\u7ed3\u679c\uff1a<\/h4>\n<p>\u03a3(1-100) = <?= $AX ?> \uff08\u7406\u8bba\u503c\uff1a5050\uff09<\/p>\n<p>    <!-- \u8c03\u8bd5\u63d0\u793a\uff08\u53c2\u8003\u7f51\u98751\u7684\u9519\u8bef\u5904\u7406\u63d0\u793a\uff09 --><br \/>\n    <?php if ($AX != 5050): ?><\/p>\n<div style=\"color:red\">\u8b66\u544a\uff1a\u8ba1\u7b97\u7ed3\u679c\u5f02\u5e38\uff0c\u8bf7\u68c0\u67e5\u5bc4\u5b58\u5668\u6ea2\u51fa\uff01<\/div>\n<p>    <?php endif ?><br \/>\n<\/body><br \/>\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d2f\u52a0\u8fc7\u7a0b\u8ffd\u8e2a\uff081+2+&#8230;+100\uff09 \u6b65\u9aa4 AX(\u7d2f\u52a0\u548c) BX(\u5f53\u524d\u6570) CX(\u5269\u4f59\u5faa\u73af) ZF\u6807&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-918","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/posts\/918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/comments?post=918"}],"version-history":[{"count":0,"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/posts\/918\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/media?parent=918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/categories?post=918"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.vlab.cn\/main\/index.php\/wp-json\/wp\/v2\/tags?post=918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}