fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N;
  6. cin >> N;
  7. long long int arr[N]={};
  8. string str;
  9. for(int i=0;i<N;i++){
  10. cin >> str;
  11. for(int j=2;j<str.length();j++){
  12. arr[i]=arr[i]*10+(str[j]-'0');
  13. }
  14. cout << arr[i] << ' ';
  15. }
  16. int ans=0;
  17. for(int i=0;i<N;i++){
  18. for(int j=0;j<N;j++){
  19. for(int k=0;k<N;k++){
  20. if(arr[i]+arr[j]==arr[k]){
  21. ans++;
  22. }
  23. }
  24. }
  25. }
  26. cout << ans << '\n';
  27. }
Success #stdin #stdout 0.01s 5388KB
stdin
3
0.100000000
0.200000000
0.300000000
stdout
100000000 200000000 300000000 3