zoukankan      html  css  js  c++  java
  • HDU 4054

    先上一枚水题,模拟。

    /*
    ID:esxgx1
    LANG:C++
    PROG:hdu4054
    */
    #include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    int main(void)
    {
        #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        #endif
    
        char ascs[4097];
    
        while(cin.getline(ascs, 4097)) {
            int len = strlen(ascs);
            for(int i=0; i<len; i+=16) {
                printf("%04x: ", i);
                int t = 0;
                while(t<min(len-i, 16)) {
                    printf("%02x", ascs[t++ +i]);
                    if (!(t % 2)) putchar(' ');
                }
                while(t < 16) {
                    printf("  "), ++t;
                    if (!(t % 2)) putchar(' ');
                }
                t = 0;
                while(t<min(len-i, 16)) {
                    if (ascs[t + i] >= 'A' && ascs[t + i] <= 'Z')
                        putchar(ascs[t + i] - 'A' + 'a');
                    else if (ascs[t + i] >= 'a' && ascs[t + i] <= 'z')
                        putchar(ascs[t + i] - 'a' + 'A');
                    else putchar(ascs[t + i]);
                    ++t;
                }
                putchar('
    ');
            }
        }
        return 0;
    }
    2014-07-28 19:12:58 Accepted 4054 15MS 316K 911 B G++
  • 相关阅读:
    MODBUS 数据格式相关记录
    STM32Cube基础工程配置
    QT5学习记录(一)
    求最大值
    算法训练方格取数
    传纸条
    分组背包
    混合背包
    二维背包
    多重背包
  • 原文地址:https://www.cnblogs.com/e0e1e/p/hdu_4054.html
Copyright © 2011-2022 走看看