https://www.acmicpc.net/problem/11724 12345678910111213141516171819202122232425262728#include #include using namespace std; int n,m,u,v,c[1001],ans;vector a[1001]; void dfs(int x){ c[x]=1; for(auto i : a[x]) if(!c[i]) dfs(i);} int main(){ scanf("%d %d",&n,&m); while(m--) { scanf("%d %d",&u,&v); a[u].push_back(v); a[v].push_back(u); } for(int i=1;i
https://www.acmicpc.net/problem/2583 DFS로 연결 요소의 개수를 세준다. 12345678910111213141516171819202122232425262728293031323334353637#include #include #include using namespace std; int m,n,k,a,b,c,d,sum,map[101][101];int dx[4]={0,0,-1,1},dy[4]={-1,1,0,0};vector v; void dfs(int x,int y){ sum++,map[x][y]=1; for(int i=0;i
https://www.acmicpc.net/problem/1924 월마다 일수를 미리 배열에 넣어두고 현재 날짜까지 일수의 합을 구한 후 모듈러 값을 이용한다. 123456789101112#include int x,y,sum,m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};char *d[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"}; int main(){ scanf("%d %d",&x,&y); for(int i=0;i
If 12 boys and their coach are going to get out of a flooded cave in northern Thailand before monsoon rains make their situation worse, it is going to have to happen soon, authorities say. The government says the boys are receiving crash courses in swimming and diving from rescue teams, though the 2.5-mile route to safety through dark, treacherous tunnels takes even the best divers around three ..
A "day" is traditionally defined as 24 hours, but in Amazon's case, it could also mean 36. The latter is what the online giant is allotting for its upcoming Amazon Prime Day on July 16, kicking off the online sales at 3pm that day, per CNNMoney. Billing what's usually its biggest sale of the year as "an epic day (and a half) of our best deals," the company will push discounts across the board, b..
I would compete in the 100 meters race. Most people think any short races in Olympic is for black athletes and actually that’s true. I want to prove them wrong. I want to be the first Asian gold medalist in the 100 meters and break Usain Bolt’s record.
As for my career, I want to make my own software service that would be used globally like Google, Facebook, or Youtube. My final goal is to build a global software company. If I see people feel happy when they use my service, I’ll feel rewarded as a software engineer. After achieving success in my business, I also want to be extremely wealthy and do what I want to do.
https://www.acmicpc.net/problem/9375 map을 이용해서 옷 종류마다 개수를 세준다. 그리고 모든 가능한 경우는 (a+1)*(b+1)* ... *(z+1)와 같이 이항계수의 성질을 이용해서 구할 수 있다. 마지막에 옷을 안 입는 경우를 하나 빼준다. 1234567891011121314151617181920212223242526#include #include #include using namespace std; int main(){ int t,n; scanf("%d",&t); while(t--) { map m; scanf("%d",&n); while(n--) { string a,b; cin>>a>>b; m[b]++; } int ans=1; for(auto it=m.begin();..