10 条题解

  • 1
    @ 2024-9-29 23:29:24
    #include <iostream>
    #include <string>
    using namespace std;
    int main(){
    	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    	string s;
    	int n;
    	char c;
    	cin >> n;
    	cin >> s;
    	cin >> c;
    	int ans = -1;
    	for(int i = 0 ; i < n ; i++){
    		if(s[i] == c){
    			ans = i;
    			break;
    		}
    	}
    	cout << ans;
    	return 0;
    }
    

    信息

    ID
    37
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    递交数
    6116
    已通过
    1170
    上传者