CodeForces 697B Barnicle 模拟
强行模拟 纪念一下……
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
char str[];
char strr[];
queue<int>take;
int main(){
while(~scanf("%s",str)){
M(strr,NULL);
int len=strlen(str);
int i=,j;
while(true){
if(str[i]=='e') break;
else strr[i]=str[i];
if(str[i]=='.') j=i;
i++;
}
// printf("%s\n",strr);
int pow_=len--i;
int ll=str[i+]-'';
for(int k=;str[i+k];k++){
ll*=;
ll+=str[i+k]-'';
}
// printf("ll==%d\n",ll);
while((strr[j+]>=''&&strr[j+]<='')&&ll){
swap(strr[j],strr[j+]);
j++,ll--;
}
// printf("ll==%d\n",ll);
int from=;
while(true){
if(strr[from]=='') from++;
else break;
}
// printf("from==%d\n",from);
if(strr[j-]=='') from--;
if(from<) from=;
int lenn=strlen(strr);
// printf("%d %c %c\n",lenn,strr[lenn-1],strr[lenn-2]);
if(strr[lenn-]=='' && strr[lenn-]=='.'){
for(int q=;q<lenn-;q++)
printf("%c",strr[q]);
puts("");
continue;
}
if(j==i-&&ll==){
// printf("222223\n");
for(int q=from;q<i-;q++)
printf("%c",strr[q]);
puts("");
}
else if(ll!=){
// printf("1111111\n");
for(int q=;strr[q];q++){
if(strr[q]=='.') break;
else printf("%c",strr[q]);
}
while(ll){
printf("");
ll--;
}
puts("");
}
else{
// printf("22222\n");
for(int q=from;q<i;q++)
printf("%c",strr[q]);
puts("");
}
}
return ;
}
CodeForces 697B Barnicle 模拟的更多相关文章
- Codeforces 679B. Barnicle 模拟
B. Barnicle time limit per test: 1 second memory limit per test :256 megabytes input: standard input ...
- codeforces 697B Barnicle
题目链接:http://codeforces.com/problemset/problem/697/B 题目大意: 将科学计数法用十进制表示.[如果类似于7.0应输出7] 解题思路: Java 中 B ...
- 【CodeForces 697B】Barnicle
对科学计数法表示的数,输出其10进制的形式. c++来做,需要考虑这些细节: 当b==0,d==0时,只输出a. 当不需要补零的情况有两种: 一种是刚好是整数,只输出a(注意1.0e1的情况是输出1) ...
- Codeforces 389B(十字模拟)
Fox and Cross Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submi ...
- codeforces 591B Rebranding (模拟)
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase E ...
- Codeforces 626B Cards(模拟+规律)
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input outp ...
- Codeforces 631C. Report 模拟
C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input out ...
- CodeForces 382C【模拟】
活生生打成了大模拟... #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsig ...
- codeforces 719C (复杂模拟-四舍五入-贪心)
题目链接:http://codeforces.com/problemset/problem/719/C 题目大意: 留坑...
随机推荐
- 关于VS2010编译警告LNK4221
最近研究duilib,准备把里面自定义的一些工具类如CDuiString什么的用ATL的替换掉,于是遇到久仰大名的 warning C4251: xxx needs to have dll-int ...
- Scala 控制结构
Scala内建的控制结构屈指可数,仅有if, while, for, match, try和函数调用而已. 几乎所有的Scala控制结构都会产生某个值(while和 do while虽然不能产生有意义 ...
- 【转】判断URL是否能够访问
import urllib2 def file_exists(url): request = urllib2.Request(url) request.get_method = lambda : 'H ...
- Java模拟post-get提交
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import ...
- 无线hacking系统—wifislax
简介 官方中文网站: http://wifislax.cn/ WiFiSlax 是在Slax基础上定制出来的,由西班牙开发.它包含了各种各样的安全和诊断工具.该发行主要的成名原因是把各种各样的非官方网 ...
- js---疑点代码段解析
function count() { var arr = []; for (var i=1; i<=3; i++) { console.log("iii---"+i); ar ...
- Java Script 学习笔记
JS编程习惯类: 1. 命名 著名的变量命名规则 只是因为变量名的语法正确,并不意味着就该使用它们.变量还应遵守以下某条著名的命名规则: Camel 标记法 首字母是小写的,接下来的字母都以大写字符开 ...
- 9、JavaScript常用函数
1.alert()函数 用于弹出消息对话框提示用户信息,消息对话框由系统提供,不同浏览器中字体样式可能不同,通常用于调试程序. 2.confirm()函数 弹出一个OK按钮和一个Cancel按钮的消息 ...
- flask安装首页显示
参考:http://flask.pocoo.org/1.安装和测试[root@node1 flask]#pip install flaskd[root@node1 flask]# cat app.py ...
- Python入门学习
1.访问www.python.org/download下载并安装Python3版本 2.命令行输入python启动交互式命令shell,>>>代表当前行用户的输入 3.基本算数运算: ...