From beb34c1bcda56c1a838814ffc732c2b22f7bcf1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?byezhao=E7=99=BD=E5=85=86?= <52312161+byezhao@users.noreply.github.com> Date: Sun, 27 Oct 2019 12:02:46 +0800 Subject: [PATCH] =?UTF-8?q?Update=20BASIC-11=20=E5=9F=BA=E7=A1=80=E7=BB=83?= =?UTF-8?q?=E4=B9=A0=20=E5=8D=81=E5=85=AD=E8=BF=9B=E5=88=B6=E8=BD=AC?= =?UTF-8?q?=E5=8D=81=E8=BF=9B=E5=88=B6.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\345\215\201\350\277\233\345\210\266.cpp" | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git "a/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-11 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\345\205\255\350\277\233\345\210\266\350\275\254\345\215\201\350\277\233\345\210\266.cpp" "b/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-11 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\345\205\255\350\277\233\345\210\266\350\275\254\345\215\201\350\277\233\345\210\266.cpp" index 4ec573e..0f92492 100644 --- "a/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-11 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\345\205\255\350\277\233\345\210\266\350\275\254\345\215\201\350\277\233\345\210\266.cpp" +++ "b/\345\237\272\347\241\200\347\273\203\344\271\240/C++/BASIC-11 \345\237\272\347\241\200\347\273\203\344\271\240 \345\215\201\345\205\255\350\277\233\345\210\266\350\275\254\345\215\201\350\277\233\345\210\266.cpp" @@ -2,19 +2,8 @@ #include using namespace std; int main() { - string s; - while (cin >> s) { - int len = s.length(); - long long sum = 0; - for (int i = 0; i < len; i++) { - if (s[i] >= 'A' && s[i] <= 'F') { - sum = sum * 16 + s[i] - 'A' + 10; - } - else { - sum = sum * 16 + s[i] - '0'; - } - } - cout << sum; - } + int n; + cin >> n; + printf("%X", n); return 0; -} \ No newline at end of file +}