# Bài 1. Expert's System ``` cpp #include <iostream> #include <cmath> using namespace std; const long long mod = 977555333311111; bool checksquare(long long n) { long long res = sqrt(n); return res * res == n; } int main() { long long n; cin >> n; if(n == 1) { cout << 0; return 0; } long long count = 0; for(int i = 1; i <= n; i++) { for(int j = i + 1; j <= n; j++) { long long tich = i * j; if(checksquare(tich)) count++; } } cout << count % mod; return 0; } ``` # Bài 2. Xenogenesis ``` cpp #include <iostream> using namespace std; #define ll long long unsigned long long sum[10005]; int main() { int n; cin >> n; ll x; cin >> x; int q; cin >> q; ll a[n+1]; for(int i = 1; i <= n; i++) { cin >> a[i]; sum[i] = sum[i-1] + a[i]; } while(q--) { int l,r; cin >> l >> r; if(sum[r] - sum[l-1] > x) cout << "SUNDAY\n"; else cout << "SUCKDAY\n"; } return 0; } ``` # Bài 3. Anagrammatization E nghĩ mình sẽ lưu các giá trị của từng truy vấn q vào 1 vector. Sau đó sort mảng lưu các giá trị lại r dùng next_permutation cho từng cái, cộng vào r lấy max, e chưa nghĩ ra cách cài đặt bài này như thế nào, mong a Spy chỉ giáo ``` cpp #include <iostream> using namespace std; int main() { } ``` # Bài 4. Mass Teleportation E chịu còn 3p hết thời gian