记录编号 41091 评测结果 AAWAAAAAAA
题目名称 [河南省队2012] 阻击补给线 最终得分 90
用户昵称 GravatarMakazeu 是否通过 未通过
代码语言 C++ 运行时间 0.092 s
提交时间 2012-07-20 15:44:54 内存使用 1.46 MiB
显示代码纯文本
  1. #include <cstdlib>
  2. #include <cstdio>
  3. using namespace std;
  4. const int MAXN=555;
  5. int mat[MAXN][MAXN];
  6. int N,M,x,y,z,ans=911111111;
  7.  
  8. inline int Min(int a,int b)
  9. {
  10. return a<b?a:b;
  11. }
  12.  
  13. inline void init()
  14. {
  15. scanf("%d %d\n",&N,&M);
  16. for(int i=1;i<=M;i++)
  17. {
  18. scanf("%d %d %d\n",&x,&y,&z);
  19. x++,y++;
  20. mat[x][y]=z,mat[y][x]=z;
  21. }
  22. }
  23.  
  24. inline void cheat()
  25. {
  26. int res=0;
  27. for(int i=1;i<=N;i++)
  28. {
  29. res=0;
  30. for(int j=1;j<=N;j++)
  31. res+=mat[i][j];
  32. if(res<ans) ans=res;
  33. }
  34. printf("%d\n",ans);
  35. }
  36.  
  37. int main()
  38. {
  39. freopen("t2bb.in","r",stdin);
  40. freopen("t2bb.out","w",stdout);
  41. init();
  42. cheat();
  43. return 0;
  44. }