东华复试OJ每日3题打卡·复盘100~102

基础100:根据一个正整数n,求出从100开始从小到大的第n个纯粹合数。

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


int func(int num){
	if(num<=9)return 0;
	 //0.确定位数
	int len=0;
	for(int i=num;i>0;i/=10){
		len++;
	}
	//1.减数 
	int Jian=1;
	for(int i=1;i<len;i++)Jian*=10;
	
	//2.减掉高位
	while(num>=Jian)num-=Jian;
	return num; 
	
	
}


int main(){
    int n=0;
    char Hang[10];
    
    while( fgets(Hang,sizeof(Hang),stdin) ){
    	n=0;
    	Hang[ strcspn(Hang,"\n")]='\0';
    	for(int i=0;i<strlen(Hang);i++){
    		n = n*10+(Hang[i] - '0');
		}

    	int num=100;
        int count=1;
        while(count < n){
            num++;
            //检测是否为合数
            int Yes=0;//是否为合数
			 
            int temp=num;
            while(temp>0){
            	int HasYinZi=0;
            	if(temp<4){
            		Yes=0;
            		break;
				}
				else {
					for(int i=2;i<=temp/2;i++){
		                if(temp%i==0){
		                    HasYinZi=1;
		                    break;
		                }
            		}
	            	if(HasYinZi==0){
	            		Yes=0;
	            		break;
					}
				}
				if(HasYinZi)Yes=1;
				//去掉高位
				temp = func(temp);
			}//逐位循环 
            if(Yes)count++;
        }//算法
        printf("%d\n",num);
        
    }
}

基础101:输入一串数字,找出其中最长的不超过4个字符的质数子串。若有多个答案,则找出其中数值最大的一个。

cpp 复制代码
//输入一行数字,找到连续数字组成最大的质数

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

int Check(int num){
	if(num==2||num==3) return 1;
	if(num%2==0)return 0;
	else{
		for(int i=3;i<=num/2;i+=2){
			if(num%i==0)return 0;
		}
		return 1;
	} 
}



int main(){
    //数字串的长度不超过20
    char Hang[30];
    while( fgets(Hang,sizeof(Hang),stdin) ){
        Hang[strcspn(Hang,"\n")] = '\0';
        //printf("%s\n",Hang);
        //辅助变量

        int ans=0;
        //1.遍历每位数字,找到其能与之后数字组成的最长最大质数串
        
        for(int i=0;i<strlen(Hang);i++){
            int temp=(Hang[i] - '0');
            //对单独一个数进行校验 
            if(Check(temp)){
                //如果是质数,则比较是否大于记录
                if(temp>ans){
                    ans = temp;
                }
            }
            for(int j=i+1;j<i+4;j++){
                temp = temp*10 + (Hang[j] - '0');
                //检验是否为质数
                if(Check(temp)){
                    //如果是质数,则比较是否大于记录
                    if(temp>ans){
                        ans = temp;
                    }
                }
            }
        }//遍历每个数字,并构成质数串

        printf("%d\n",ans);
        
    }//每次数据的循环
}

基础102:一串以'@'为结束标志的字符串,从左至右对其进行翻译,若字符串中当前字符是整数n(0≤n≤9),则表示将后一个字符重复n+1次,不论后一个字符是否为数字,且后一个字符无需再次翻译;若当前字符非数字,则表示自己,无需翻译,直接输出即可。

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

int main(){
    char Hang[15];
    while(fgets(Hang,sizeof(Hang),stdin)){
        Hang[strcspn(Hang,"\n")] = '\0';
        int count = 0;
        
        
        int repeat = 0;
        for(int i=0;i<strlen(Hang);i++){
            if(repeat){
            	repeat++;
               while(repeat){
                   printf("%c",Hang[i]);
                   repeat--; 
                   count++;
                   if(count%3==0 && !(i==strlen(Hang)-1 && repeat==0) )printf(" ");
                   
               }
            }
            else{
                if(Hang[i]>='0' && Hang[i]<='9')repeat=Hang[i]-'0';
                else{
                	printf("%c",Hang[i]);
                	count++;
                   if(count%3==0 && !(i==strlen(Hang)-1 && repeat==0) )printf(" ");
				} 
            }
        }
        printf("\n");
    }
}

Computer scientists continue to expand the frontiers of computer and information systems by pioneering the designs of more complex, reliable, and powerful computers; enabling networks of computers to efficiently exchange vast amounts of information; and seeking ways to make computers behave intelligently. As computers become an increasingly integral part of modern society, computer scientists strive to solve new problems and invent better methods of solving current problems.

  • pioneering 开创/引领做先锋,integral 内在的/不可或缺的
  • 计算机科学家们继续探索计算机和信息系统的边界,引领着更复杂、更可信赖、更强大的计算机设计,他们使计算机网络能高效地交换大量信息并探索让计算机表现智能化的方法。随着计算机在现代社会中越来越不可分割,计算机科学家努力解决新问题和发明解决当前问题的更优解。

The goals of computer science range from finding ways to better educate people in the use of existing computers to highly speculative research into technologies and approaches that may not be viable for decades. Underlying all of these specific goals is the desire to better the human condition today and in the future through the improved use of information.

  • speculative 推测的/冒险的、highly speculative 纯理论推测的
  • 计算机科学的目标范围从找到更好地指导人们使用现有计算机的方法,到可能数十年都不可行的技术与方法中进行高度推测性的研究 。隐藏在所有特定目标下的是渴望改善人类当今与未来的境况 通过在未来对信息的使用改进更好地利用信息

Computer science is a combination of theory, engineering, and experimentation. In some cases, a computer scientist develops a theory, then engineers a combination of computer hardware and software based on that theory, and experimentally tests it. An example of such a theory-driven approach is the development of new software engineering tools that are then evaluated in actual use. In other cases, experimentation may result in new theory, such as the discovery that an artificial neural network exhibits behavior similar to neurons in the brain, leading to a new theory in neurophysiology.

  • neurophysiology 神经生理学
  • 计算机科学结合了理论、工程学和实验。在一些情况下,计算机科学家构建理论模型,然后基于该理论设计并构建计算机 硬件和软件的计算机结合体,最后实验测试该机器。这样一个理论驱动的方法的一个例子先开发 新软件工程工具的开发然后在实际使用中 并评估实际使用情况。在其他情况下,实验会引发新理论的发现,例如人工神经网络表现出与大脑里的神经元相似的行为,便催生了神经生理学的新理论
相关推荐
Nan_Shu_6145 分钟前
学习:MapVGL 地理信息可视化
学习
皖山文武15 分钟前
逻辑代数基础学习笔记--概述
笔记·学习·机器学习
fanged17 分钟前
高通学习24--XBL(TODO)
学习
咸甜适中1 小时前
rust语言AI编程学习笔记(五)clap命令行参数解析
学习·rust·ai编程
诗句藏于尽头1 小时前
deepseek harness对接商汤科技免费大模型使用教程
人工智能·科技·学习
chemddd1 小时前
豆包生成 亚马逊链接的视频
学习·交友
weixin_431600441 小时前
NestJS 入门(7):生命周期钩子——构造函数和 `OnModuleInit` 差在哪?
前端·后端·学习·node.js·nest.js
工业HMI实战笔记2 小时前
解放双手,声控未来:抗噪语音交互如何革新嘈杂车间的HMI操作体验
人工智能·学习·自动化·制造
知识分享小能手2 小时前
线性代数学习教程,从入门到精通,相似矩阵及二次型 — 知识点详解(9)
学习·线性代数·机器学习
小弥儿3 小时前
GitHub今日热榜 | 2026-08-14:OSINT情报工具回流,本地AI赛道升温
人工智能·学习·开源·github