博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cheering Gym-101522C
阅读量:4157 次
发布时间:2019-05-26

本文共 1068 字,大约阅读时间需要 3 分钟。

Cheering Gym-101522C


题意:

在一个字符串(N≤100)中,子串LSC,PCMS谁出现的次数多输出谁,相等输出Tie。

(1)直接法

#include 
#include
intmain() { char n[105]; int i, len, lsc = 0, pcms = 0; gets(n); len = strlen(n); for( i = 0; i < len; i++ ) { if( n[i] == 'L' && n[i + 1] == 'S' && n[i + 2] == 'C' ) { lsc++; } if( n[i] == 'P' && n[i + 1] == 'C' && n[i + 2] == 'M' && n[i + 3] == 'S' ) { pcms++; } } if( lsc > pcms ) { puts("LSC"); } else if( lsc < pcms ) { puts("PCMS"); } else { puts("Tie"); } return 0;}

(2)库函数

#include 
#include
intmain() { char n[105]; int i, len, lsc = 0, pcms = 0; gets(n); len = strlen(n); for( i = 0; i < len; i++ ) { if( strncmp(n + i, "LSC", 3) == 0 ) { lsc++; } if( strncmp(n + i, "PCMS", 4) == 0 ) { pcms++; } } if( lsc > pcms ) { puts("LSC"); } else if( lsc < pcms ) { puts("PCMS"); } else { puts("Tie"); } return 0;}

转载地址:http://fvkxi.baihongyu.com/

你可能感兴趣的文章
Joint Tracking and Segmentation of Multiple Targets
查看>>
Subgraph Decomposition for Multi-Target Tracking
查看>>
JOTS: Joint Online Tracking and Segmentation
查看>>
CDT: Cooperative Detection and Tracking for Tracing Multiple Objects in Video Sequences
查看>>
Improving Multi-frame Data Association with Sparse Representations for Robust Near-online Multi-ob
查看>>
Virtual Worlds as Proxy for Multi-Object Tracking Analysis
查看>>
Multi-view People Tracking via Hierarchical Trajectory Composition
查看>>
Online Multi-Object Tracking via Structural Constraint Event Aggregation
查看>>
The Solution Path Algotithm for Identity-Aware Multi-Object Tracking
查看>>
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>