CF 999 B. Reversing Encryption

题目地址

分析:

  规律:当i为n的倍数时,从0至i翻转(从前往后)

新知识: reverse(s+a,s+b);把字符串s中,地址从a到b间的内容反转

代码:

 1 #include<iostream>
 2 #include<algorithm>
 3 #include<cstring>
 4 using namespace std;
 5
 6 int main()
 7 {
 8     char s[105];
 9     int n;
10     cin >> n >> s;
11     for(int i = 1; i <= n; i++)
12         if(n%i == 0)
13             reverse(s,s+i);
14     cout << s << endl;
15     return 0;
16 }

原文地址:https://www.cnblogs.com/JiaaaaKe/p/9502495.html

时间: 2024-11-14 11:56:49

CF 999 B. Reversing Encryption的相关文章

Reversing Encryption

A string ss of length nn can be encrypted(加密) by the following algorithm: iterate(迭代) over all divisors(除数) of nn in decreasing order (i.e. from nn to 11), for each divisor dd, reverse the substring s[1…d]s[1…d] (i.e. the substring which starts at po

CF 999 div3

A 从左往右扫一遍统计答案,如果等于n就输出n,否则再从右往左扫一遍,再原来的答案上累加答案 #include <iostream> #include <cstdio> using namespace std; int a[105], n, k; int main() { cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; int ans = 0; for (int i = 1;

Codeforces Round #490 (Div. 3)

A.Mishka and Contest 思路:简单贪心.每次删掉首尾不超过k的元素,直到分别第一次遇到超过k的元素就不再继续删除即可. AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <iostream> 6 #include <algorithm> 7 #include <iom

一场CF的台前幕后(上)——转

前奏 大约4月份的时候,业界毒瘤pyx噔噔噔跑过来说:“酷爱!我YY了一道题!准备当CF的C” 我当时就被吓傻了."Yet another Chinese round?" “区间取模,区间求和” 感觉这题还不错?不过pyx嫌水了…… 好办!当时我刚刚出完动态仙人掌不久,于是一拍脑袋说:把这个问题出到仙人掌上去! 当然被pyx鄙视了…… 后来一直就没啥动静,直到5月底的CTSC. 试机的时候pyx给我看了套他出的神题……里面有一道题……我不小心读成了下面这个样子: “给定n个m维的模2意

AES advanced encryption standard 3

This optimized <../aesbench/> AES implementation conforms to FIPS-197. aes.h #ifndef _AES_H #define _AES_H #ifndef uint8 #define uint8 unsigned char #endif #ifndef uint32 #define uint32 unsigned long int #endif typedef struct { uint32 erk[64]; /* en

AES advanced encryption standard 2

/* * FIPS-197 compliant AES implementation * * Copyright (C) 2006-2007 Christophe Devine * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redi

Setting up libvirt for TLS (Encryption &amp; Authentication)

Setting up libvirt for TLS (Encryption & Authentication) Setting up your virtualisation infrastructure for Transport Layer Security (TLS) isn't very difficult. However, it can be a bit involved for someone not already familiar with the details. These

微信 {&quot;errcode&quot;:40029,&quot;errmsg&quot;:&quot;invalid code, hints: [ req_id: Cf.y.a0389s108 ]&quot;}

{"errcode":40029,"errmsg":"invalid code, hints: [ req_id: Cf.y.a0389s108 ]"} 问题:微信网页授权后,获取到 openid 了,一刷新又没了 微信网页授权获取到的 code 只能使用一次(5分钟内有效),使用一次后,马上失效. 页面授权跳转成功,根据 code 也换取到 openid 了. 此时刷新页面,并不会再次进行授权,而是直接刷新了一下上一次授权跳转后的链接,带的还是

backup, file manipulation operations (such as ALTER DATABASE ADD FILE) and encryption changes on a database must be serialized.

昨天在检查YourSQLDba备份时,发现有台数据库做备份时出现了下面错误信息,如下所示: <Exec>   <ctx>yMaint.ShrinkLog</ctx>   <inf>Log Shrink</inf>   <Sql> --  ======================================================================== -- Shrink of log file E:\SQ