东华复试OJ每日3题打卡·复盘88~90

基础88:对于一个字符串,编程找出其中的所有整数。例如,字符串"a12bc34d05",其中有整数12、34、5。

cpp 复制代码
#include <stdio.h>
#include <stdlib.h>

int main(){
    char data[500];
    
    while( fgets(data,sizeof(data),stdin) ){
        int UnFirstPrint=0;
        int count = 0;
        for(int i=0;i<500;i++){//第一次遍历得到数字个数
            if(data[i]=='\n' || data[i]=='\0')break;
            if(data[i]>='0' && data[i]<='9'){
                count++;
                for(int j=i;j<500;j++){
                    i=j;//带着移动i
                    if(data[i]>='0' && data[i]<='9'){}
                    else break;
                }
            }
        }//第一次遍历得到数字个数
        if(count == 0)printf("%d");
        else printf("%d ",count);
        
        
        //-------
        
        for(int i=0;i<500;i++){//遍历输出一个数 
        	if(data[i]=='\n' || data[i]=='\0')break;
            if(data[i]>='0' && data[i]<='9'){
            	int printfZero=0;//决定是否输出0 
                
                for(int j=i;j<500;j++){
                    i=j;//带着移动i
                    if(data[i]>='0' && data[i]<='9'){//是数字 
                    	if(data[i] !='0'){
                    		printf("%c",data[i]);
							printfZero=1;//输出非0后可输出0
						}
						else if(printfZero && (data[i] =='0'))printf("0");
					}
                    else break;
                }
                count--;
                if(count)printf(" ");
                
            }
		}
        
        printf("\n");
        
    }//大循环
    
    
}

基础89:输入一串字符,其长度小于200,判断该串字符是否构成回文。 所谓回文是指从左到右和从右到左读一串字符的值是一样的,如:ABCBA。

cpp 复制代码
#include <stdio.h>
#include <stdlib.h>

int main(){
    char data[500];
    while( fgets(data,sizeof(data),stdin) ){
        int length = 0;
        for(int i=0;i<500;i++){//第一次遍历得到数组长度
            if(data[i]=='\n' || data[i]=='\0')break;
            else length++;
        }
        int correct=1;
        for(int i=0;i<length;i++){
            if(data[i] != data[length-1-i]){
                correct=0;
                break;
            }
        }
        if(correct)printf("Yes\n");
        else printf("No\n");
	}	
}

基础90:输入一行字符串,全部由小写字母构成,对字符串按26个英文字母的先后顺序进行排序,然后输出。

cpp 复制代码
#include <stdio.h>
#include <stdlib.h>

int main(){
    char data[500];
     while( fgets(data,sizeof(data),stdin) ){
        int length = 0;
        for(int i=0;i<500;i++){//第一次遍历得到数组长度
            if(data[i]=='\n' || data[i]=='\0')break;
            else length++;
        }
         for(char ch='a';ch<='z';ch++){//a~z
             for(int i=0;i<length;i++){
                 if(data[i] == ch)printf("%c",data[i]);
             }
         }
         printf("\n");
	}	


}

To return, then, to the switching capabilities of a modern computer:computers in the 1970s were generally able to handle eight switches at a time. That is, they could deal with eight binary digits, or bits, of data, at every cycle. A group of eight bits is called a byte, each byte containing 256 possible patterns of ONs and OFFs (or 1s and 0s). Each pattern is the equivalent of an instruction, a part of an instruction, or a particular type of datum, such as a number or a character or a graphics symbol. The pattern 11010010, for example, might be binary data-in this case, the decimal number 210-or it might be an instruction telling the computer to compare data stored in its switches to data stored in a certain memory-chip location.

  • capabilities 能力,digits 数字,equivalent 等同,datum 数据,graphics 图像,graphics symbol 图形符号
  • 然后,回到现代计算机的切换能力:在20世纪70年代,电脑一次能处理八次切换。这意味着那时的电脑在每个循环能处理八个二进制数或比特的数据。八个比特为一组成为一个字节,每个字节通过开和关能表达256种可能模式。每个模式等价于一条指令或是一条指令的一部分,也可能是数据的特殊类型,例如一个数字、一个字符或是图形符号。例如模式11010010,在这一案例中可以是二进制数据即十进制的数字210,或可能是一条指令让电脑对比存在开关的数据和存在特定存储器芯片位置的数据。

The development of processors that can handle 16, 32, and 64 bits of data at a time has increased the speed of computers. The complete collection of recognizable patterns-the total list of operations-of which a computer is capable is called its instruction set. Both factors-the number of bits that can be handled at one time, and the size of instruction sets continue to increase with the ongoing development of modern digital computers.

  • collection 集合,capable 可以/能胜任,ongoing 进行中/持续的
  • continue to increase with ... 随着......的发展而持续增长
  • 处理器发展到能一次处理16、32、64位的数据,这给计算机加了速。计算机 可识别模式的完整集合全部模式 ------即可执行 操作的完整表单列表 ------计算机能被称之为指令集。这两个因素------一次能处理的比特数和指令集的规模------正随着 现代数字计算机的持续发展而不断增长

Modern digital computers are all conceptually similar, regardless of size. Nevertheless, they can be divided into several categories on the basis of cost and performance: the personal computer or microcomputer, a relatively low-cost machine, usually of desktop size (though "laptops" are small enough to fit in a briefcase, and "palmtops" can fit into a pocket); the workstation, a microcomputer with enhanced graphics and communications capabilities that make it especially useful for office work; the minicomputer, generally too expensive for personal use, with capabilities suited to a business, school, or laboratory; and the mainframe computer, a large, expensive machine with the capability of serving the needs of major business enterprises, government departments, scientific research establishments, or the like (the largest and fastest of these are called supercomputers).

  • desktop 台式,mainframe 主机,major business enterprises 大型商业公司,minicomputer 小型机, mainframe computer 大型机。
  • 与尺寸无关,现代数字计算机在概念上都是相似的。尽管如此,它们能基于价格和性能划分为几个类别:个人电脑或微电脑,通常是 相对低费用的机器通常是台式尺寸(尽管笔记本电脑小到足以装入公文包,而掌上电脑能装进口袋)。工作站,一个微电脑随着增强了 图像和通信能力的微型计算机 提高使其专用于办公室的工作。小型机 通常对于个人使用过于昂贵,其能力适于商业、学校或实验室。大型机是一个大型的昂贵的机器,其性能足以服务于大型商业公司、政府部门、科学研究协会或是诸如此类(这种大型快速的机器被称为超级计算机)。
相关推荐
不吃橘子的橘猫2 小时前
《集成电路设计》复习资料3(电路模拟与SPICE)
学习·算法·集成电路·仿真·半导体
开发者导航2 小时前
【开发者导航】多功能生成模型开发工具:Diffusers 详细介绍
人工智能·python·学习·macos·信息可视化
我命由我123453 小时前
Visual Studio 文件的编码格式不一致问题:错误 C2001 常量中有换行符
c语言·开发语言·c++·ide·学习·学习方法·visual studio
运维管理3 小时前
H3C交换机Hybrid端口配置与VLAN理解-学习
运维·网络·学习
pyniu4 小时前
Elasticsearch学习
后端·学习·elasticsearch·搜索引擎
liliangcsdn4 小时前
IMPALA强化学习算法的学习和解读
学习·算法
蒸蒸yyyyzwd4 小时前
os八股学习笔记
笔记·学习
野犬寒鸦4 小时前
Java8 ConcurrentHashMap 深度解析(底层数据结构详解及方法执行流程)
java·开发语言·数据库·后端·学习·算法·哈希算法
郝学胜-神的一滴4 小时前
在Vibe Coding时代,学习设计模式与软件架构
人工智能·学习·设计模式·架构·软件工程