您的位置:首页 > 其它

2013年湘潭大学程序设计比赛(Internet)部分解题报告

2013-03-10 21:49 417 查看
题目链接: http://202.197.224.59/OnlineJudge2/index.php/Contest/problems/contest_id/24
就做了几个简单题直接上代码吧~

A题: Assembly Line

View Code

#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <string>
#include <stdlib.h>
using namespace std;
int T;
char s[10005];
int t[20], n;
void fuck( int n, int m)
{
memset( t, 0, sizeof( t ) );
int i=0;
while( n ){
t[i++]=n%2;
n/=2;
}
i=5;
while( m ){
t[i++]=m%2;
m/=2;
}
}
void fuck2(  )
{
int ans=0;
for( int i=7; i>=0; --i )
ans*=2, ans+=t[i];
printf( "%02x", ans );
}
int main( )
{
scanf( "%d", &T );
while( T -- ){
scanf( "%s", s );
int l=strlen( s );
for( int i=0; s[i]; ++i){
int n=1;
while( s[i+1]&&s[i+1]==s[i] && n<8 ){
i++; n++;
puts( s+n );
}
fuck( s[i]-'a', n-1 );
fuck2( );
}
puts( "" );
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: