#include<stdio.h> #include <string.h> int main() { int n, m; scanf("%d %d", &n, &m); char str_n[20], str_m[20]; sprintf(str_n, "%d", n); sprintf(str_m, "%d", m); int count_n[10] = {0}; int count_m[10] = {0}; for (int i = 0; i < strlen(str_n); i++) { count_n[str_n[i] - '0']++; } for (int i = 0; i < strlen(str_m); i++) { count_m[str_m[i] - '0']++; } int unique_n = 0, unique_m = 0; for (int i = 0; i < 10; i++) { if (count_n[i] > 0) unique_n++; if (count_m[i] > 0) unique_m++; } if (unique_n >
It seems like the code you provided is incomplete and has been cut off at the end. However, I can help you complete it based on what you have so far. The code appears to be counting the number of unique digits in two integers `n` and `m`. The counts are stored in arrays `count_n` and `count_m`, respectively. Then, the number of unique digits for each integer is calculated by checking how many elements in these arrays are greater than zero. To complete the code, you need to decide what you want to do with the counts of unique digits. For example, you might want to print them out, compare them, or use them in some other way. Here's an example of how you could print out the number of unique digits for both `n` and `m`: ```c #include<stdio.h> #include <string.h> int main() { int n, m; scanf("%d %d", &n, &m); char str_n[20], str_m[20]; sprintf(str_n, "%d", n); sprintf(str_m, "%d", m); int count_n[10] = {0}; int count_m[10] = {0}; for (int i = 0; i < strlen(str_n); i++) { count_n[str_n[i] - '0']++; } for (int i = 0; i < strlen(str_m); i++) { count_m[str_m[i] - '0']++; } int unique_n = 0, unique_m = 0; for (int i = 0; i < 10; i++) { if (count_n[i] > 0) unique_n++; if (count_m[i] > 0) unique_m++; } printf("Number of unique digits in %d: %d\n", n, unique_n); printf("Number of unique digits in %d: %d\n", m, unique_m); return 0; } ``` This code will print out the number of unique digits in both `n` and `m`. If you had a different requirement in mind, please provide more details so that I can assist you further. [2024-10-18 11:48:35 | AI写代码神器 | 566点数解答]
- [讯飞星火] #include<stdio.h> #include <string.h> int main() { int n, m; scanf("%d %d", &n, &m); char str_n[20], str_m[20]; sprintf(str_n, "%d", n); sprintf(str_m, "%d", m); int count_n[10] = {0}; int count_m[10] = {0}; for (int i = 0; i < strlen(str_n); i++) { count_n[str_n[i] - '0']++; } for (int i = 0; i < strlen(str_m); i++) { count_m[str_m[i] - '0']++; } int unique_n = 0, unique_m = 0; for (int i = 0; i < 10; i++) { if (count_n[i] > 0) unique_n++; if (count_m[i] > 0) unique_m++; } if (unique_n >(566点数解答 | 2024-10-18 11:48:35)247
- [字节豆包] 采用c++语言,实现如下功能: 实现古典密码中的移位密码和仿射密码,具体实现如下接口: c++接口: <<<<<移位密码>>>>> bool is_valid_s(unsinged char k) { 判断k是否为合理的密钥 } int encrypt_s(unsigned char* p, unsigned char k) { 密钥合法则返回1,且密文覆盖明文: 密钥不合法则返回0. } int decrypt_s(unsigned char* c, unsigned char k) { 密钥合法则返回1,且明文覆盖密文: 密钥不合法则返回0. } <<<<<仿射密码>>>>> bool in_valid_a(unsinged char a, unsigned char b) { 判断a,b是否为合理的密钥 } int encrypt_a(unsigned char* p, unsigned char a, unsigned char b) { 密钥合法则返回1,且密文覆盖明文: 密钥不合法则返回0. } int decrypt_a(unsigned char* c, unsign(812点数解答 | 2024-12-18 16:02:36)331
- [字节豆包] #include<iostream> #include<complex.h> #include <complex> #include <math.h> using namespace std; #define pi 3.14159265358979323846 int main() { file* stream; stream = fopen("4000-red.raw","rb"); unsigned char* image = (unsigned char*)malloc(4000 * 4000 * sizeof(unsigned char)); fread(image,4000*4000,sizeof(unsigned char),stream); unsigned char* image2 = (unsigned char*)malloc(4000 * 4000 * sizeof(unsigned char)); unsigned char* image3 = (unsigned char*)malloc(4000 * 4000 * sizeof(unsigned(413点数解答 | 2024-11-02 18:16:35)300
- [阿里通义] 检查代码 #include <ctype.h> #include <string.h> void verse(char* str) { *str = tolower(*str); int lens = strlen(str); printf("字符串长度为:%d\n", lens); for (int i = 0; i < lens / 2; i++) { char temp = str[i]; str[i] = str[lens - 1 - i]; str[lens - 1 - i] = temp; } } int pali(char *str) { int lens=strlen(str); char *reverse[lens+1]; strcpy(reverse, str); verse(reverse); return strcmp(str, reverse)==0; } int main() { char str[101];(655点数解答 | 2024-11-08 21:54:45)260
- [讯飞星火] ```c #include <stdio.h> #include <string.h> #include <ctype.h> void reverseWord(char *word) { int len = strlen(word); for (int i = 0; i < len / 2; i++) { char temp = word[i]; word[i] = word[len - i - 1]; word[len - i - 1] = temp; } } void processWord(char *word) { if (isdigit(word[0])) { reverseWord(word); } else if (islower(word[0])) { for (int i = 0; i < strlen(word); i++) { word[i] = toupper(word[i]); } } el(1192点数解答 | 2025-11-26 09:45:04)41
- [GPT] // // main.cpp // step1 // // created by ljpc on 2018/8/31. // copyright © 2018年 ljpc. all rights reserved. // #include <iostream> #include <stack> #include <cstring> #include <algorithm> using namespace std; int main(int argc, const char * argv[]) { // 请在这里补充代码,完成本关任务 /********* begin *********/ stack<char> s1; stack<char> s2; char s[200]; fgets(s,200,stdin); int len=strlen(s); if(s[len-1]=='\n'){ s[len-1]='\0'; len--; } char(518点数解答 | 2024-10-25 17:28:04)220
- [讯飞星火] 解释下列代码 #include <stdio.h> #include <string.h> // 定义排序字符串的函数 void sortstring(char *a, char *b) { int len = strlen(a); strcpy(b, a); // 先将 a 的内容复制到 b 中 // 使用冒泡排序对字符串进行排序 for (int i = 0; i < len - 1; i++) { for (int j = 0; j < len - i - 1; j++) { if (b[j] > b[j + 1]) { // 交换 b[j] 和 b[j + 1] char temp = b[j]; b[j] = b[j + 1]; b[j + 1] = temp; } } } } int main() { char a[(1092点数解答 | 2024-11-27 08:08:34)184
- [字节豆包] 6-22 删除字符串中指定的字符 分数 10 作者 王跃萍 单位 东北石油大学 编写函数fun,函数的功能是:从字符串中删除指定的字符。同一字母的大、小写按不同字符处理。 函数接口定义: int fun(char s[],char c); 其中 s 和 c 都是用户传入的参数。 函数从字符串 s中删除指定的字符c 。同一字母的大、小写按不同字符处理。 裁判测试程序样例: #include <stdio.h> int fun(char s[],char c); int main() { static char str[]="turbocandborlandc++"; char ch; scanf("%c",&ch); printf("原始字符串:%s\n", str); fun(str,ch); printf("str[]=%s\n",str); return 0; } /* 请在这里填写答案 */ 输入样例: c 输出样例: 原始字符串:turbocandborlandc++ str[]=turboandborland(211点数解答 | 2025-01-21 21:18:10)253
- [GPT] void sr(struct student* sr) //输入函数 显示器输入(录入学生信息) { int i = 0; printf("请输入学生的个数:"); scanf("%d", &d); system("cls");//清屏 for (; i < d; i++) { printf("请输入学生的姓名:"); scanf("%s", (*(sr + i)).name); printf("请输入学生的学号:"); scanf("%d", &(*(sr + i)).num); printf("请输入学生的语文成绩:"); scanf("%f", &(*(sr + i)).chinese); printf("请输入学生的数学成绩:"); scanf("%f", &(*(sr + i)).math); printf("请输入学生的英语成绩:"); scanf("%f", &(*(sr + i)).english); printf("请输入学生的计算机成绩:"); scanf("%f", &(*(sr + i)).c(5点数解答 | 2024-07-02 08:40:40)301
- [字节豆包] #include <iostream> #include <sstream> #include <string> #include <cctype> #include <vector> // 将字符串转换为小写 std::string toLowerCase(const std::string& str) { std::string result = str; for (char& c : result) { c = std::tolower(c); } return result; } int main() { std::string target; std::getline(std::cin, target); target = toLowerCase(target); std::string article; std::getline(std::cin, article); std::stringstream ss(article); std::vector<std::(1381点数解答 | 2025-12-15 17:32:28)31
- [字节豆包] #include<stdio.h> #include<string.h> #include<ctype.h> int · main() { ···· char · str[21]; ···· fgets(str, · sizeof(str), · stdin); ···· int · upper=0, · lower=0, · digit=0, · other=0; ···· ···· for(int · i=0; · i<strlen(str); · i++) ···· { ········ char · ch=str[i]; ········ if(ch · == · '\n') · continue; ········ ········ if(isupper(ch)) · upper++; ········ else · if(islower(ch)) · lower++; ········ else (541点数解答 | 2025-11-30 12:03:00)38
- [字节豆包] 6-5 字符串比较 分数 5 全屏浏览 切换布局 作者 王跃萍 单位 东北石油大学 函数fun的功能是比较两个字符串,如果s1=s2,则返回值0;如果s1>s2,则返回值1;如果s1<s2,则返回-1。 函数接口定义: int fun(char a[],char b[]); 其中a、b是用户传入的参数。 函数比较两个字符串,如果a=b,则返回值0;如果a>b,则返回值1;如果a<b,则返回-1。 裁判测试程序样例: #include "stdio.h" #include "string.h" int fun(char a[],char b[]); int main() {int t; char s1[40],s2[40]; gets(s1); gets(s2); t=fun(s1,s2); printf("%d\n",t); return 0; } /* 请在这里填写答案 */ 输入样例: asd fg 输出样例: -1 (178点数解答 | 2025-12-10 18:29:54)49