QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#796700 | #6992. Caesar Cipher | Gourab_Biswas# | AC ✓ | 0ms | 3844kb | C++20 | 2.7kb | 2024-12-02 00:09:03 | 2024-12-02 00:09:03 |
Judging History
answer
///jai sri krishna
///jai maa kali
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef tree<
ll,
null_type,
less_equal<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define db double
#define pii pair<ll,ll>
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b,c) for(ll i=a;i<b;i+=c)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define fri(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define pb push_back
#define ss second
#define ff first
#define in insert
#define sq(x) (x*x)
#define all(a) a.begin(),a.end()
#define nl "\n"
#define mnpq priority_queue <pii, vector<pii>, greater<pii> >
ll gcd(ll a,ll b){
if(b==0)return a;
return gcd(b,a%b);
}
int getRandom(int L,int R)
{
return rng()%(R-L+1) + L;
}
ll lcm(ll a,ll b){
return ((a)/gcd(a,b))*b;
}
ll bigmod(ll a,ll n,ll md){
if(n==0){
return 1;
}
if(n==1){
return a%md;
}
ll d= bigmod(a,n/2,md);
if(n%2==0){
return (d*d)%md;
}
else{
return ( ((d*d)%md) * (a%md) )%md;
}
}
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
if(a.first==b.first){
return (a.second > b.second);
}
return (a.first< b.first);
}
const ll N = 103000;
const ll mod = 998244353;
const ll neginf= -1e18;
const ll inf = 1e9;
const ld eps= 1e-9;
/// Solve part by part
/// Think small case
/// Think reverse order
/// Take best solution
/// test against atleast 10 cases
/// give 10 min before submission
/// wrong submission 20 min penalty
/// use binary search for maximum minimum problem
/// use broute force to check test case in another solution
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t;
cin>>t;
f(i,1,t+1){
ll n,m;
cin>>n>>m;
string ss,tt;
cin>>ss>>tt;
string rr;
cin>>rr;
ll d1=(ss[0]-'A');
ll d2=(tt[0]-'A')+26;
ll df=(d2-d1);
string res="";
f(j,0,rr.size()){
ll d=rr[j]-'A';
d-=df;
while(d<0){
d+=26;
}
char ch=d+'A';
res+=ch;
}
cout<<"Case "<<"#"<<i<<": ";
cout<<res<<nl;
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
1 7 7 ACMICPC CEOKERE PKPIZKC
output:
Case #1: NINGXIA
result:
ok 3 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
50 13 17 QHTWLYQKPWWMF TKWZOBTNSZZPI ZMNVMCRXALWYDGEQH 22 43 UVODXVNTBFCPCYQNVTZGOB WXQFZXPVDHEREASPXVBIQD QPDUBYVLOYAISDULLCKTMYTBNYPPHVKYJKUUIXGBRIU 12 15 XQOEAHPCECGP VOMCYFNACAEN DONXFWMMTBGNHIV 12 22 LIPJSGBNANXU EBICLZUGTGQN JKSXVASDNGTLJFOWVDGQDV 13 40 BGJHQVBCMLQND LQTRAFLMWVAXN UDQREUFWBGIH...
output:
Case #1: WJKSJZOUXITVADBNE Case #2: ONBSZWTJMWYGQBSJJAIRKWRZLWNNFTIWHISSGVEZPGS Case #3: FQPZHYOOVDIPJKX Case #4: QRZECHZKUNASQMVDCKNXKC Case #5: KTGHUKVMRWYXEDHAXQCLTXKOCSFPKQXKAZXQSRPM Case #6: ZQIRTMTIKTENA Case #7: GD Case #8: N Case #9: PLCAOJZKAIELLKYHWHJHKLDCHVLFECTIMQAQQENZCLTJWUOCJ Case #10...
result:
ok 150 tokens