Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:A不出来,谁可以让我看看他的呀

Posted by chavanel at 2008-07-03 16:12:52 on Problem 1298
In Reply To:A不出来,谁可以让我看看他的呀 Posted by:lijianac at 2008-03-07 17:35:16
#include <iostream>
#include <string>

using namespace std;

string shift(string str){
	int i;
	for (i=0;i<str.length();i++){
		if (str[i]>='A'&&str[i]<='Z') str[i]=(str[i]-'A'+21)%26+'A';
	}
	return str;
}

int main(){
	string temp,ans[1000];
	int flag=0;
	int i,j;
	for (i=0; ;i++){
		for (j=0; ;j++){
			cin>>temp;
			if (temp=="START") continue;
			else if (temp=="END") break;
			else if (temp=="ENDOFINPUT"){
				flag=1;
				break;
			}
			else ans[i]=ans[i]+shift(temp)+" ";
		}
	if (flag==1) break;
	}
	for (j=0;j<i;j++) cout<<ans[j]<<endl;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator