// 間違っていたので修正 // O(N^2M) 解法 #include #include #include using namespace std; using ll = long long; bool dp[1000000][100]; int frm[10000]; int to[10000]; ll N, M, T, ans; int main(){ cin >> N >> M >> T; for(int i=0;i> frm[i] >> to[i]; } dp[0][0] = true; int T_max = N * N + 10 * N; for(int t=1;t<=T_max;t++){ for(int e=0;e N){ ll p = t2 - t1; ans += ((T-t2)%p==0 ? 1 : 0); } } } if(ans==0){ ans-=1; } cout << ans << endl; return 0; }