东华复试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 大型机。
  • 与尺寸无关,现代数字计算机在概念上都是相似的。尽管如此,它们能基于价格和性能划分为几个类别:个人电脑或微电脑,通常是 相对低费用的机器通常是台式尺寸(尽管笔记本电脑小到足以装入公文包,而掌上电脑能装进口袋)。工作站,一个微电脑随着增强了 图像和通信能力的微型计算机 提高使其专用于办公室的工作。小型机 通常对于个人使用过于昂贵,其能力适于商业、学校或实验室。大型机是一个大型的昂贵的机器,其性能足以服务于大型商业公司、政府部门、科学研究协会或是诸如此类(这种大型快速的机器被称为超级计算机)。
相关推荐
Don.TIk7 小时前
SpringCloud学习笔记
笔记·学习·spring cloud
red_redemption7 小时前
自由学习记录(131)
学习
Shining05967 小时前
推理引擎方向(二)《大模型原理与结构》
人工智能·rnn·深度学习·学习·其他·大模型·infinitensor
WJSKad12357 小时前
ECA瓶颈改进YOLOv26通道注意力与残差学习深度融合突破
深度学习·学习·yolo
咕噜咪7 小时前
OpenLayers 入门教程:从零开始学习Web地图开发
前端·学习
cd11840518 小时前
AutoCAD Electrical 2020学习笔记
笔记·学习
ADHD多动联盟8 小时前
当孩子上课小动作多,如何有效改善学习困难?
学习·学习方法·玩游戏
Sarvartha9 小时前
递归、回溯与动态规划学习笔记
笔记·学习·动态规划
小光学长10 小时前
基于ssm的膳食健康管理系统e6whl4q7(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
java·开发语言·数据库·学习·ssm
weixin_4588726111 小时前
东华复试OJ二刷复盘7
学习