zju 3542 Hexadecimal View (大连现场赛水题)
2011-10-02 18:01
176 查看
一觉醒来,不觉已经是4点了,于是果断挑了一道水题。
View Code
View Code
#include<stdio.h> #include<string.h> #include <cctype> char str[5000]; int main() { int i,j,k; while(gets(str)) { char s[]="0000"; int len=strlen(str); int row=len/16; int left=len%16; int a=0; for(i=0;i<row;i++) { printf("%04x: ",a+i*16); for(j=0;j<16;j++) { if((j+1)%2) printf("%x",str[i*16+j]); else printf("%x ",str[i*16+j]); } for(j=0;j<16;j++) { int t=i*16+j; if( isupper(str[t])) putchar(str[t]+32); else if( islower(str[t])) putchar(str[t]-32); else putchar(str[t]); } printf("\n"); } if(left) { printf("%04x: ",a+i*16); for(j=0;j<left;j++) { if((j+1)%2) printf("%x",str[i*16+j]); else printf("%x ",str[i*16+j]); } for(j=0;j<16-left;j++) { if(j%2) printf(" "); else printf(" "); } for(j=0;j<left;j++) { int t=i*16+j; if( isupper(str[t])) putchar(str[t]+32); else if( islower(str[t])) putchar(str[t]-32); else putchar(str[t]); } printf("\n"); } } }
相关文章推荐
- zju 3542 Hexadecimal View (大连现场赛水题)
- ZOJ 3542 Hexadecimal View [2011大连现场赛]
- ACM-ICPC 长沙现场赛 C 题 ZOJ3728(为什么我A过的数学题都是水题T_T)
- 2011 ACM/ICPC 大连赛区现场赛题解:Compress the String
- Detachment (Hdu5976)2016大连现场赛F题
- hdu-1018亚洲赛区现场赛的水题吧?
- 58届世界小姐大连大赛现场
- 英雄会第二届在线编程大赛·CSDN现场决赛:三元组的数量【水题】
- HDU 4059 The Boss on Mars 2011大连现场赛
- HDU 4813 Hard Code(水题,2013年长春现场赛A题)
- 58届世界小姐大连大赛现场
- ZOJ 3542 2011大连现场赛D题(简单模拟)
- trainging contest#1(2011大连现场赛)I BY bly
- trainging contest#1(2011大连现场赛)C BY bly
- hdu 5982(16青岛现场赛)Relic Discovery水题
- ZJU 3733 长沙现场赛 H Skycity
- 2016acmicpc现场赛大连赛区D题
- ZOJ 3657 The Little Girl who Picks Mushrooms 第37届ACM/ICPC长春赛区现场赛C题(水题)
- 动态规划 杭电4001 大连赛区网络赛水题
- hdu 5538 House Building(长春现场赛——水题)