UVA11192 Group Reverse

问题链接:UVA11192 Group Reverse。入门练习题,用C语言编写程序。

AC的C语言程序如下:

/* UVA11192 Group Reverse */

#include <stdio.h>
#include <string.h>

#define MAXN 100

int main(void)
{
    int n, start, end, i;
    char s[MAXN], c;

    while(scanf("%d", &n) != EOF && n != 0) {
        scanf("%s", s);

        n = strlen(s) / n;
        for(i=0; s[i]; i+=n) {
            start = i;
            end = i + n - 1;
            while(start < end) {
                c = s[start];
                s[start] = s[end];
                s[end] = c;

                start++;
                end--;
            }
        }

        printf("%s\n", s);
    }

    return 0;
}
时间: 2024-10-18 01:20:23

UVA11192 Group Reverse的相关文章

djfhkjdahsg 将会对会计师公会斯蒂芬

http://f.dangdang.com/group/24690/7818358/ http://f.dangdang.com/group/24690/7818366/ http://f.dangdang.com/group/24690/7818410/ http://f.dangdang.com/group/24690/7818420/ http://f.dangdang.com/group/24690/7818408/ http://f.dangdang.com/group/24690/7

供应科顾客顾客顾客

http://f.dangdang.com/group/24554/3373214/http://f.dangdang.com/group/24554/3373218/http://f.dangdang.com/group/24554/3373222/http://f.dangdang.com/group/24554/3373227/http://f.dangdang.com/group/24554/3373230/http://f.dangdang.com/group/24554/337323

放假放假放假凤凰男

http://f.dangdang.com/group/24554/3373214/http://f.dangdang.com/group/24554/3373218/http://f.dangdang.com/group/24554/3373222/http://f.dangdang.com/group/24554/3373227/http://f.dangdang.com/group/24554/3373230/http://f.dangdang.com/group/24554/337323

Forward Proxy vs Reverse Proxy

Overview We've talked about reverse proxy servers and how they can really be good at protecting the servers in your internal network. Lately, however, we've realized that some people actually think we're talking about forward proxy servers or that th

[leetcode]Reverse Nodes in k-Group @ Python

原题地址:https://oj.leetcode.com/problems/reverse-nodes-in-k-group/ 题意: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should

LeetCode[Linked List]: Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nod

Reverse Nodes in k-Group [逆转K-Group链表]

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nod

[LeetCode] 025. Reverse Nodes in k-Group (Hard) (C++/Java)

索引:[LeetCode] Leetcode 题解索引 (C++/Java/Python/Sql) Github: https://github.com/illuz/leetcode 025. Reverse Nodes in k-Group (Hard) 链接: 题目:https://oj.leetcode.com/problems/reverse-nodes-in-k-group/ 代码(github):https://github.com/illuz/leetcode 题意: 把一个链表每

LeetCode-Algorithms #007 Reverse Integer, Database #182 Duplicate Emails

LeetCode-Algorithms #007 Reverse Integer 给定一个32位整数, 将其各位反转并返回, 如果结果超出取值范围就返回0 1 class Solution { 2 public int reverse(int x) { 3 //对原数取绝对值 4 int y = Math.abs(x); 5 //将原数转换为字符串 6 String s1 = Integer.toString(y); 7 //将字符串转换为字符数组 8 char[] arr = s1.toCha