蒟蒻求救,玄学WA0分

P1906 凯撒密码

QNDJR
by wxy_god @ 2019-08-21 22:22:06


关注重点吧!我急死了
by 反比例函数 @ 2019-08-21 22:24:01


请不要质疑一道通过194的题目
by wxy_god @ 2019-08-21 22:24:48


不是质疑,仅是认为我的程序可能有没对此做出判断的瑕疵
by 反比例函数 @ 2019-08-21 22:26:13


## ~~窝不会做啊awa~~
by 一滴小水滴 @ 2019-08-21 22:30:24


@[反比例函数](/space/show?uid=59995) 在线IDE上一测你这连样例都过不了
by wxy_god @ 2019-08-21 22:32:00


~~毒瘤码风,看不懂~~
by F1aMiR3 @ 2019-08-21 22:33:04


~~本机是怎么A的~~
by wxy_god @ 2019-08-21 22:34:38


虽说看不懂,不过你这个应该是getline读入的字符串的问题,比如说这个START长度应该是6而不是5
by lzx1999 @ 2019-08-21 22:47:18


我改了一下你的代码,你看看吧,我交了一下WA了一个点 ```cpp #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<cctype> using namespace std; class rk { public: int num; char data;}t[128]; int main() { string s,b,e; int i,f,cnt=0; while(getline(cin,s)) { for(i=0;i<s.size();i++) if(islower(s[i])) s[i]=toupper(s[i]); if(s=="START\r"||s=="END\r") continue; else if(s=="ENDOFINPUT\r") return 0; cnt++; memset(t,0,sizeof t); int len=s.size(); for(i=0;i<len;i++) if(isalpha(s[i])) { if(islower(s[i])) s[i]=s[i]-'a'+'A'; t[(int)s[i]].num++;t[(int)s[i]].data=s[i];} sort(t,t+128,[](const rk &a,const rk &b) { if(a.num==b.num) return a.data>b.data; return a.num>b.num;}); if(cnt==1) f=t[0].data-'E'; for(i=0;i<len;i++) { if(isalpha(s[i])) { s[i]-=f; if(s[i]>'Z') s[i]-=26; if(s[i]<'A') s[i]+=26;}} cout<<s<<endl;}} ```
by lzx1999 @ 2019-08-21 22:51:42


| 下一页