답안 #661325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
661325 2022-11-25T13:55:21 Z Trisanu_Das Lozinke (COCI17_lozinke) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n; cin >> n;
  string a[n];
  set<string> s;
  map<string, int> mp;
  for(int i = 0; i < n; i++){  
  	cin >> a[i];
    for(int j = 0; j < a[i].size(); j++){
      string ss;
      for(int k = j; k < a[i].size(); k++){
        ss += a[i][k];
        s.insert(ss);
      }
    }
  }
  int ans = 0;
  for(string ss : s) mp[ss]++;
  for(string ss : mp) ans += mp[ss]++;
  cout << ans - n << '\n';
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int j = 0; j < a[i].size(); j++){
      |                    ~~^~~~~~~~~~~~~
lozinke.cpp:13:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |       for(int k = j; k < a[i].size(); k++){
      |                      ~~^~~~~~~~~~~~~
lozinke.cpp:21:19: error: conversion from 'std::pair<const std::__cxx11::basic_string<char>, int>' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   21 |   for(string ss : mp) ans += mp[ss]++;
      |                   ^~