USACO报告:chapter1.1:Your Ride Is Here
来源:互联网 发布:q房网经纪人端口下载 编辑:程序博客网 时间:2024/06/11 07:18
//练手的第一题,比较简单,其实就是字符串操作。
/*ID:fairchi1PROG: rideLANG:C++*/#include <iostream>#include <fstream>#include <string>using namespace std;int main(){ ifstream fin ("ride.in"); ofstream fout("ride.out"); string e, c; fin>>e; fin>>c; int ee=1,cc=1,i; for( i=0;i<e.size();i++) ee*=e[i]-'A'+1; for( i=0;i<c.size();i++) cc*=c[i]-'A'+1; if((ee%47)==(cc%47)) fout<<"GO"<<endl; else fout<<"STAY"<<endl; return 0;}
总结:
题目不难,考察字符串的操作。
看了看一个样例代码,发现头文件ctype.h的应用,其中:
isalpha(int ch)的应用以前没见过,这个函数用于判断该元素是不是字母,。注意新版的编译器可能需要加头文件cctype.h,而且ch如果是字母,必须转换为int型,因为该函数只接受int类型参数。isupper(int ch) 判断函数是否为大写字母,参数为大写英文字母(A-Z)时,返回非零值,否则返回NULL(0)。,islower(int ch)判断函数是否为小写字母,若参数c为小写英文字母,则返回TRUE,否则返回NULL(0)。说明一点,其实这三个函数只是宏定义,不是真正的函数。
- USACO报告:chapter1.1:Your Ride Is Here
- usaco Your Ride Is Here 报告
- 【USACO-Chapter1-1.1】【字符串处理】Your Ride Is Here
- USACO 1.1.1 Your Ride Is Here
- [USACO 1.1.1] Your Ride Is Here
- USACO 1.1.1 Your Ride Is Here
- USACO 1.1.1 Your Ride Is Here
- USACO 1.1.1 Your Ride Is Here
- USACO 1.1.1 Your Ride Is Here
- USACO-Section1.1 Your Ride Is Here
- USACO-Section1.1 Your Ride Is Here
- USACO-Section1.1 Your Ride Is Here
- USACO Section1.1 Your Ride Is Here
- USACO:Your Ride Is Here
- your ride is here(USACO)
- usaco--Your Ride Is Here
- [USACO] Your Ride Is Here
- USACO:Your Ride Is Here
- HDU 2601 An easy problem
- CFileDialog 使用 OFN_ALLOWMULTISELECT 标志选择多个文件
- the algorithms to solve the question X^N
- 谷歌地图
- 高速发展的中国的社会问题,潜在超级大国和未来经济大势
- USACO报告:chapter1.1:Your Ride Is Here
- C++ 学习使用 MFC CFileDialog
- powershell basic
- powershell connect sql server
- powershell seach const variable
- 通过反射获得类的实例对象
- EditView 输入问题
- Android APK反编译
- iOS 通过URL网络获取XML数据的两种方式