UVa10878 - Decode the tape-字符串-难度1
来源:互联网 发布:衣着判断 知乎 编辑:程序博客网 时间:2024/06/05 20:29
题目链接:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1819
Decode the tape
Time Limit: 1 second
Alan Turing
Your boss has just unearthed a roll of old computer tapes. The tapes have holes in them and might contain some sort of useful information. It falls to you to figure out what is written on them.
Input
The input will contain one tape.
Output
Output the message that is written on the tape.
___________| o . o|| o . || ooo . o|| ooo .o o|| oo o. o|| oo . oo|| oo o. oo|| o . || oo . o || ooo . o || oo o.ooo|| ooo .ooo|| oo o.oo || o . || oo .oo || oo o.ooo|| oooo. || o . || oo o. o || ooo .o o|| oo o.o o|| ooo . || ooo . oo|| o . || oo o.ooo|| ooo .oo || oo .o o|| ooo . o || o . || ooo .o || oo o. || oo .o o|| o . || oo o.o || oo . o|| oooo. o || oooo. o|| o . || oo .o || oo o.ooo|| oo .ooo|| o o.oo || o. o |___________
A quick brown fox jumps over the lazy dog.
Problemsetter: Igor Naverniouk
Special thanks: BSD games ppt.
代码+思路:
/* *主要是理解题意: *去除'.',其余7位组成ASCII码,'o'表示对应位是1 */#include <iostream>#include <cstdio>#include <cstring>#include <string>using namespace std;const int MAX = 101;char ans[MAX][MAX];int main(){#ifdef LOCALfreopen("f:\\input.txt", "r", stdin);//freopen("f:\\output.txt", "w", stdout);#endifstring s;int first = 0;while(getline(cin, s)){if(s[0] == '_'){if(first == 1) {cout << endl;break;}else{continue;}}int sum = 0;int time = 1;for(int i = 9; i != 1; i--){if(s[i] == 'o'){sum += time;}if(s[i] != '.')//如果是'.', 跳过这位time = 2 * time;}printf("%c", sum);}return 0;}
0 0
- UVa10878 - Decode the tape-字符串-难度1
- UVa10878 Decode the tape
- UVa10878 - Decode the tape
- UVA10878 - Decode the tape
- UVA10878 Decode the tape
- UVA10878 - Decode the tape
- 字符串-10878 Decode the tape
- UVA 10878 - Decode the tape(字符串)
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- Qt画平滑曲线
- android各种权限及说明
- 极速理解设计模式系列:1.建造者模式(Builder Pattern)
- 设计模式之工厂模式
- Maximum size of malloc()
- UVa10878 - Decode the tape-字符串-难度1
- Oracle数据库JDBC连接
- 3Dmax2014 monitor.exe关闭问题
- 修改用户名、改变语言环境
- 字符串的完美度--英雄会<高校俱乐部>
- [Jweb] 在 servlet 中重写 service() 方法,不重写 doGet, doPost 方法,示例。
- 云计算实战 之查询执行模块
- 把数据从控制器传递到视图
- 编译x264 出现No working C compiler found.