diff --git a/4081_npeople/npeople.cpp b/4081_npeople/npeople.cpp index adea7ee..f7cc530 100644 --- a/4081_npeople/npeople.cpp +++ b/4081_npeople/npeople.cpp @@ -1,7 +1,9 @@ #include #include using namespace std; + int n,a[100000]={0}; + int mins(){ if(a[n-2]-a[0]==n-2&&a[n-1]-a[n-2]>n-2){ return 2; @@ -19,6 +21,7 @@ int mins(){ } return n-ans; } + int main() { cin >> n; @@ -28,4 +31,5 @@ int main() sort(a,a+n); cout< - +using namespace std; int main() { - std::cout << "Hello Easy C++ project!" << std::endl; + int n, m, rdui[100001] = { 0 }, jiad = 0, fud = 0; + bool dui[100001] = { 0 }; + cin >> n >> m; + for (int i = 1; i <= m; i++) { + int yi, er; + char u; + cin >> u >> yi >> er; + if (rdui[yi] == 0 && rdui[er] == 0) { + jiad++; + rdui[yi] = jiad; + rdui[er] = jiad; + } + if (rdui[yi] != 0 && rdui[er] == 0) { + rdui[er] = rdui[yi]; + } + if (rdui[yi] == 0 && rdui[er] != 0) { + rdui[yi] = rdui[er]; + } + if (rdui[yi] != 0, rdui[er] != 0) { + fud++; + if (dui[rdui[yi]] == 0 && dui[rdui[er]] == 0) { + dui[rdui[er]] = 1; + } else { + if (dui[rdui[yi]] == 1 && dui[rdui[er]] == 1) { + fud--; + } else { + dui[rdui[yi]] = dui[rdui[er]] == 1; + } + } + } + } + + int ll = jiad - fud; + cout << "1"; + for (int i = 1; i <= ll; i++) { + cout << "0"; + } + return 0; } diff --git a/4083_mit/main.exe b/4083_mit/main.exe index fc4df42..c33eb7e 100644 Binary files a/4083_mit/main.exe and b/4083_mit/main.exe differ diff --git a/4083_mit/test/out.txt b/4083_mit/test/out.txt index 52ef4e1..b6dd4f1 100644 --- a/4083_mit/test/out.txt +++ b/4083_mit/test/out.txt @@ -1,18 +1,18 @@ ## z:\Chao\src\4083_mit\test\in.txt -2020/04/06 周一 12:33:23.89 -10 +2020/06/13 周六 11:23:05.54 +1 ----------------------------------------------- -Process exited after 260 ms with return value 0 +Process exited after 170 ms with return value 0 ## z:\Chao\src\4083_mit\test\In1 (19).txt -2020/04/06 周一 12:33:23.89 +2020/06/13 周六 11:23:05.54 1 ----------------------------------------------- -Process exited after 190 ms with return value 0 +Process exited after 170 ms with return value 0 ## z:\Chao\src\4083_mit\test\In2 (12).txt -2020/04/06 周一 12:33:23.89 +2020/06/13 周六 11:23:05.54 1 ----------------------------------------------- -Process exited after 210 ms with return value 0 +Process exited after 170 ms with return value 0 diff --git a/Template copy/Readme.md b/Template copy/Readme.md new file mode 100644 index 0000000..b4f8d75 --- /dev/null +++ b/Template copy/Readme.md @@ -0,0 +1,3 @@ +# 标题 + +* 内容 \ No newline at end of file diff --git a/Template copy/doc/Readme.md b/Template copy/doc/Readme.md new file mode 100644 index 0000000..4e768b5 --- /dev/null +++ b/Template copy/doc/Readme.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/Template copy/main.cpp b/Template copy/main.cpp new file mode 100644 index 0000000..29eaf6f --- /dev/null +++ b/Template copy/main.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; +bool ce[20001]={0}; +int main(){ + int n; + int a[101],ans=0; + cin>>n; + for(int i=1;i<=n;i++){ + cin>>a[i]; + ce[a[i]]=1; + } + for(int i=1;i<=n-1;i++){ + for(int j=i+1;j<=n;j++){ + int now=a[i]+a[j]; + if(ce[now]==1){ + ans++; + ce[now]=0; + } + } + } + cout<