【Leetcode_easy】997. Find the Town Judge】的更多相关文章

problem 997. Find the Town Judge solution: class Solution { public: int findJudge(int N, vector<vector<int>>& trust) { vector<); ]]--; balance[t[]]++; } ; i<=N; i++) { ) return i; } ; } }; 参考 1. Leetcode_easy_997. Find the Town Judge…
题目如下: In a town, there are N people labelled from 1 to N.  There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 度 日期 题目地址:https://leetcode.com/problems/rotting-oranges/ 题目描述 In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town…
https://leetcode.com/problems/find-the-town-judge/ In a town, there are N people labelled from 1 to N.  There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (exc…
[题目大意] 一个球初始体积为1,一天天变大,第一天变大1倍,第二天变大2倍,第n天变大n倍.问当第 n-1天的时候,体积变为多少.注意答案对n取模. [题解] 根据威尔逊定理:(n-1)! mod n =-1 所以当n为质数时,答案就是n-1 否则答案显然是0 注意4要特判一下,ans[4]=2 这里有一种很魔性的判素数的方法,详见代码 /************* HDU 5391 by chty 2016.11.4 *************/ #include<iostream> #i…
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完…
problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binary Numbers; 完…
problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完…
problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完…
problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Order; 完…