Compile Error
foo.cc: In function 'void solve()':
foo.cc:29:5: error: 'llint' was not declared in this scope; did you mean 'lrint'?
29 | llint n, same = 0;
| ^~~~~
| lrint
foo.cc:30:12: error: 'n' was not declared in this scope; did you mean 'yn'?
30 | cin >> n;
| ^
| yn
foo.cc:39:17: error: 'same' was not declared in this scope
39 | same++;
| ^~~~
foo.cc:42:17: error: 'same' was not declared in this scope
42 | cout << 2 * same<<endl;
| ^~~~
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vecint vector<int>
#define vecchar vector<char>
#define max_ele(v) *max_element(v.begin(), v.end())
#define min_ele(v) *min_element(v.begin(), v.end())
#define sort(v) sort(v.begin(), v.end())
#define rev_sort(v) sort((v).begin(), (v).end(), greater<>())
#define Reverse(v) reverse(v.begin(), v.end())
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define coutall(v) \
for (auto &it : v) \
cout << it << " "
#define coutnewline(v) \
for (auto &it : v) \
cout << it << '\n'
#define cinall(v) \
for (auto &it : v) \
cin >> it
#define yes cout << "YES\n"
#define no cout << "NO\n"
void solve()
{
llint n, same = 0;
cin >> n;
cin.ignore();
string ch;
getline(cin, ch);
for (int i = 0; i < n - 1; i++)
{
for (int j = i + 1; j < n; j++)
{
if (ch[i] == ch[j])
same++;
}
}
cout << 2 * same<<endl;
}
int main()
{
int tests;
cin >> tests;
while (tests-- > 0)
{
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1038 E. Do not touch my string
- Contest
- Brain Booster #3
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-05-06 15:59:02
- Judged At
- 2024-11-11 03:33:34
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes