#include<stdio.h> #include<string.h> #define ll long long struct node { ll wo;ll di; }map[205][205]; int n,m; bool solve() { for(int i=1;i<=n;i++) { ll sset=0;ll tset=0; for(int j=1;j<=n;j++) { sset+=map[j][i].wo; tset+=map[i][j].di; } if(sset>tset) return false; } return true; } int main() { int CAS; scanf("%d",&CAS); for(int kcas=1;kcas<=CAS;kcas++) { for(int i=1;i<=202;i++) for(int j=1;j<=202;j++) { map[i][j].wo=0;map[i][j].di=0; } scanf("%d%d",&n,&m); int u,v;ll d,b; for(int i=1;i<=m;i++) { scanf("%d%d%lld%lld",&u,&v,&d,&b); map[u][v].wo=d; map[u][v].di=d+b; } if(solve()) printf("Case #%d: happy\n",kcas); else printf("Case #%d: unhappy\n",kcas); } return 0; } /* Main.c:9:1: error: unknown type name 'bool' bool solve() ^ Main.c: In function 'solve': Main.c:24:15: error: 'false' undeclared (first use in this function) return false; ^ Main.c:24:15: note: each undeclared identifier is reported only once for each function it appears in Main.c:26:12: error: 'true' undeclared (first use in this function) return true; ^ Main.c:27:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ */ |
Double click to view unformatted code.