UVa 10945 - Mother bear
来源:互联网 发布:国培网络研修成果 编辑:程序博客网 时间:2024/04/29 09:27
题目:有一只熊,你如果说出回文串他就不吃你,否则就吃掉你,判断结果。
分析:字符串。直接取出所有字母,转化成小写,判断即可。
说明:有写错库文件了╮(╯▽╰)╭。
#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;char A[1000],B[1000];int main(){while ( gets(A) ) {if ( !strcmp( A, "DONE" ) )break;int count = 0;for ( int i = 0 ; A[i] ; ++ i ) {if ( A[i] >= 'a' && A[i] <= 'z' )B[count ++] = A[i];if ( A[i] >= 'A' && A[i] <= 'Z' )B[count ++] = A[i]+'a'-'A';}int l = 0,r = count-1,flag = 1;while ( l < r ) {if ( B[l] != B[r] ) {flag = 0; break;}l ++; r --;}if ( flag ) printf("You won't be eaten!\n");else printf("Uh oh..\n");}return 0;}
0 0
- Uva 10945 - Mother bear
- UVa 10945 - Mother bear
- mother的含义
- Mother'd Day
- “mother certified good boy”
- 5.13 mother's day
- API mixerGetNumDevs Mother, Id1
- One-Eyed Mother
- Does your mother know
- About Mother’s Day
- HF见Mother
- Mother's Milk(usaco)
- 1.4Mother's Milk
- Mother's Milk
- Mother's Milk
- usaco mother'smilk
- usaco Mother's Milk
- Mother's Milk
- oracle 得到本周的数据
- cp: omitting directory `XXX'
- Android打开现有工程
- 截取当前屏幕图像,并将图片存入沙盒中。
- VC++中如何复制对话框资源
- UVa 10945 - Mother bear
- hdu 3037 Saving Beans(组合数学)
- PrintDataGridView视图打印
- android 网络图片双缓存
- 】OpenCV中GPU模块使用
- 心情不好~~
- 更新UI的两种方法——handler和runOnUiThread()
- Linux commands
- TCP/IP Http Https 总结