zoukankan      html  css  js  c++  java
  • 两道题

    1、

    #include<stdio.h>
    #include<iostream>
    #include<string.h>
    #include<algorithm>
    using namespace std;

    int List[1000];
    int main(){
    int CaseNumber = 0;
    cin>>CaseNumber;
    while(CaseNumber --){
    int ListNumber = 0;
    cin>>ListNumber;
    int num = 0;
    for(int i = 0; i < ListNumber; i++){
    while(cin >> List[num]){
    if(List[num] == -1){
    break;
    }else {
    num ++;
    }
    }
    }
    sort(List, List+num);
    for(int i = 0; i < num; i++){
    cout<<List[i];
    if(i != num -1){
    cout<<" ";
    }
    }cout<<endl;
    }
    }

    2、

    #include<stdio.h>
    #include<iostream>
    #include<string.h>
    #include<algorithm>
    using namespace std;

    char List[1000];
    char Father[1000];
    int main(){
    int CaseNumber = 0;
    cin>>CaseNumber;
    while(CaseNumber --){
    scanf("%s", List);
    int num = 0;;
    for(int i = 0 ;i < strlen(List); i++){
    if(List[i] == '#'){
    continue;
    }
    int son = 0;
    if(i *2+1 < strlen(List) && List[i * 2 + 1] != '#'){
    son += 1;
    }
    if(i *2+2 < strlen(List) && List[i * 2 + 2] != '#'){
    son += 1;
    }
    if(son == 1){
    Father[num++] = List[i];
    }
    }
    cout<<num<<":";
    for(int i = 0 ;i < num; i++){
    cout<<Father[i];
    }
    cout<<endl;
    }
    }
    /*
    1
    A#B###C
    */

  • 相关阅读:
    docker-排除故障
    python的标识符
    python的数据类型
    python的数与字符串
    场景法
    正交试验法
    错误推测法
    决策表法
    因果图法
    python基础--用python执行系统命令
  • 原文地址:https://www.cnblogs.com/icodefive/p/10461575.html
Copyright © 2011-2022 走看看