ZOJ Problem Set - 3713
题意:给定一个字符串,用字符串ASC2码16进制数输出 ,并在前面输出字符串长度的16进制,输出长度的规则是 先输出长度的二进制数的后七位的十六进制(如果左边还有1 则这在后七位前面加上个1再输出 然后二进制数右移动七位,直到左边没有1) 注:所有16数都必须为两位!
解题思路:对长度进行输出处理
解题代码:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
char str[];
int bi[];
void print(int x)
{
if (x < )
printf("0%d",x);
else if(x < )
printf("0%c",'A'+(x-));
else
{
if(x / <)
printf("%d",x/);
else if(x/ < )
printf("%c",'A'+(x/-));
if(x% < )
printf("%d",x%);
else
printf("%c",'A'+(x%-)); } }
int main(){ //freopen("/home/plac/problem/input.txt","r",stdin);
//freopen("/home/plac/problem/output.txt","w",stdout);
int t;
scanf("%d",&t);
getchar();
while(t--)
{
gets(str);
int k = strlen(str);
int b = ,c = , d= ;
// scanf("%d",&k);
if(k >= b)
{
print(k%d+d);
print(k%c/d+d);
print(k%b/c+d);
print(k/b);
}
else if(k >= c)
{
print(k%d+d);
print(k%c/d+d);
print(k/c);
}
else if(k >= d)
{
print(k%d +d);
print(k/d);
}
else print(k); for(int i = ;i < k ;i ++)
if(str[i] < )
print(str[i]);
else
print(str[i]);
printf("\n"); }
return ;
}
ZOJ Problem Set - 3713的更多相关文章
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1025解题报告
ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...
- ZOJ Problem Set - 3829Known Notation(贪心)
ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...
- ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】
称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...
- ZOJ Problem Set - 3593 拓展欧几里得 数学
ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...
- ZOJ Problem Set - 2297 Survival 【状压dp】
题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...
- ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】
题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...
- ZOJ Problem Set - 3229 Shoot the Bullet 【有上下界网络流+流量输出】
题目:problemId=3442" target="_blank">ZOJ Problem Set - 3229 Shoot the Bullet 分类:有源有汇 ...
- ZOJ Problem Set - 3822Domination(DP)
ZOJ Problem Set - 3822Domination(DP) problemCode=3822">题目链接 题目大意: 给你一个n * m的棋盘,每天都在棋盘上面放一颗棋子 ...
随机推荐
- XBee® ZigBee 模块使用方法
Digi的ZigBee模块简称S2,根据芯片版本的不同历史上分别有S2,S2B,S2C等,每次硬件平台升级,都会引入一个新的尾缀字母.历史版本中S2和S2B已经停产并被S2C替代.当前S2C是主流平台 ...
- shell脚本编写遍历某一目录下的所有文件
遍历/root/321321/目录显示里面的所有文件 #!/bin/bash dir=`ls /root//` #定义遍历的目录 for i in $dir do echo $i done
- Codeforces Round #536 (Div. 2) F 矩阵快速幂 + bsgs(新坑) + exgcd(新坑) + 欧拉降幂
https://codeforces.com/contest/1106/problem/F 题意 数列公式为\(f_i=(f^{b_1}_{i-1}*f^{b_2}_{i-2}*...*f^{b_k} ...
- git遇到的问题-- Another git process seems to be running in this repository
执行git add .时,报错 fatal: Unable to create '/Users/lily/ForWork/forReBaomai/bm-fe/.git/index.lock': Fil ...
- 数据库 的几种链接 join
直接demo,懒的同学可以看看效果 两个表的数据 join和inner join一样 full join报错,可有大神知道原因?
- 再谈docker基本命令
子曰,温故而知新 今日,再次看书之际,又寻得docker的几条使用命令,用小本本记下来 配置docker镜像源 当我们在拉去一些共有镜像时,默认,docker会向docker.io去获取,如果在拉取的 ...
- 如何在已安装Python解释器的Linux上更新Python
在Linux环境下升级Python (附:解决pip报错 subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned ...
- XML生成XAMl扩展
所有的WPF控件列为枚举 代码如: 1 public enum ControlType 2 { 3 Window_Resources, 4 Page_Resources, 5 Grid, 6 Stac ...
- IDEL中easyui使用jstl和el出现传值不显示的问题
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding=& ...
- Java程序入口:main()方法讲解
Java程序的入口---main()方法的签名为:public static void main(String[] args) {...} ,其中, ♦ public修饰符:Java类由JVM调用,为 ...