5 条题解

  • 1
    @ 2023-12-27 9:42:45

    小飞棍来咯 #include<stdio.h> #include<string.h> int main() { char str[100000] = { 0 }; int times[26] = { 0 }; int index[26] = { 0 }; gets(str); int length = strlen(str); for (int i = 0; i < length; i++) { switch (str[i]) { case 'a':times[0]++; index[0] = i; break; case 'b':times[1]++; index[1] = i; break; case 'c':times[2]++; index[2] = i; break; case 'd':times[3]++; index[3] = i; break; case 'e':times[4]++; index[4] = i; break; case 'f':times[5]++; index[5] = i; break; case 'g':times[6]++; index[6] = i; break; case 'h':times[7]++; index[7] = i; break; case 'i':times[8]++; index[8] = i; break; case 'j':times[9]++; index[9] = i; break; case 'k':times[10]++; index[10] = i; break; case 'l':times[11]++; index[11] = i; break; case 'm':times[12]++; index[12] = i; break; case 'n':times[13]++; index[13] = i; break; case 'o':times[14]++; index[14] = i; break; case 'p':times[15]++; index[15] = i; break; case 'q':times[16]++; index[16] = i; break; case 'r':times[17]++; index[17] = i; break; case 's':times[18]++; index[18] = i; break; case 't':times[19]++; index[19] = i; break; case 'u':times[20]++; index[20] = i; break; case 'v':times[21]++; index[21] = i; break; case 'w':times[22]++; index[22] = i; break; case 'x':times[23]++; index[23] = i; break; case 'y':times[24]++; index[24] = i; break; case 'z':times[25]++; index[25] = i; break; } } int min = 99999999; int xxx = 10086; for (int j = 0; j < 26; j++) { if (times[j] == 1) { if (min >= index[j]) { min = index[j]; xxx = j; } } } switch (xxx) { case 0: printf("a"); break; case 1: printf("b"); break; case 2: printf("c"); break; case 3: printf("d"); break; case 4: printf("e"); break; case 5: printf("f"); break; case 6: printf("g"); break; case 7: printf("h"); break; case 8: printf("i"); break; case 9: printf("j"); break; case 10: printf("k"); break; case 11: printf("l"); break; case 12: printf("m"); break; case 13: printf("n"); break; case 14: printf("o"); break; case 15: printf("p"); break; case 16: printf("q"); break; case 17: printf("r"); break; case 18: printf("s"); break; case 19: printf("t"); break; case 20: printf("u"); break; case 21: printf("v"); break; case 22: printf("w"); break; case 23: printf("x"); break; case 24: printf("y"); break; case 25: printf("z"); break; case 10086:printf("no"); break; } return 0; }

    • 0
      @ 2023-12-12 15:38:47
      #include<stdio.h>
      int main()
      {
      	int b[28]={0},wz[28]={0};
      	int c=0,min=200005,u=0;
      	for(int i=1;i<200000;i++)
      	{
      		char a=getchar();
      		if(a=='\n')break;
      		c=a;
      		if(b[c-96]>=2)continue;
      		b[c-96]++;
      		if(b[c-96]==1);
      	}
      	for(int i=1;i<=26;i++)
      	{
      		if(b[i]==1)
      		{
      			printf("%c",i+96);
      			u++;
      			break;
      		}
      	}
      	if(u==0)printf("no");
      	return 0;
       } 
      
      • 0
        @ 2023-11-16 13:20:04

        排序下遍历 #include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; sort(s.begin(),s.end()); for(int i=1;i<s.size();i++) { if(s[i]==s[i+1]){i++; } else if(s[i]!=s[i-1]&&s[i]!=s[i+1]) { cout<<s[i];return 0; } } cout<<"no"; return 0; }

        • 0
          @ 2023-11-16 11:40:56
          #include<stdio.h>
          #include<string.h>
          int main()
          {
              char a[100000];
              gets(a);
              int len=strlen(a);
              int i,j;
              int count[26];
              int judge[26];
              int de=0;
              for(j=0;j<26;j++)
              {
                  count[j]=0;
              }
              for(i=0;i<len;i++)
              {
                  a[i]=a[i]-97;
              }
              for(i=0;i<len;i++)
              for(j=0;j<26;j++)
              {
                  if(a[i]==j)
                  count[j]++;
              }
              for(j=0;j<26;j++)
              {
                  if(count[j]==1)
                  {
                     de++;
                     judge[j]=j+97;
                  }
              }
              if(de==0)
              printf("no");
              for(i=0;i<len;i++)
              {
                  a[i]=a[i]+97;
              }
              int flag=0;
              for(i=0;i<len;i++)
              {
                  if(flag==1)
                  break;
                  for(j=0;j<26;j++)
                  {
                      if(a[i]==judge[j])
                      {
                          printf("%c",a[i]);
                          flag=1;
                      }
                  }
              }   
              return 0;
          }
          
          • 0
            @ 2023-9-23 11:56:22
            import java.util.Scanner;
            
            public class Main {
                public static void main(String[] args) {
                    final Scanner scanner = new Scanner(System.in);
                    final String in = scanner.nextLine();
                    final int[] points = new int[26];
                    for (int i = 0; i < in.length(); i++) {
                        int index = in.charAt(i) - 97;
                        points[index] = points[index] + 1;
                    }
                    for (int i = 0; i < 26; i++) {
                        int point = points[i];
                        if (point != 1) continue;
                        System.out.println((char) (i + 97));
                        return;
                    }
                    System.out.println("no");
                }
            }
            
            • 1

            信息

            ID
            131
            时间
            1000ms
            内存
            128MiB
            难度
            9
            标签
            (无)
            递交数
            2491
            已通过
            141
            上传者