dengxinyi 6 éve
szülő
commit
897d2fc5b9
1 módosított fájl, 20 hozzáadás és 9 törlés
  1. 20 9
      poj/2050.searching-the-web/main.cc

+ 20 - 9
poj/2050.searching-the-web/main.cc

@@ -1,26 +1,37 @@
 #include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <string>
 
 const int N = 100;
 const int LEN = 80;
 const int NUM = 1500;
 const int M = 50000;
 
-const char asterisks[] = "**********";
-const char dashes[] = "----------";
-const char equals[] = "==========";
-const char nothing[] = "Sorry, I found nothing.";
+const char asterisks[] = "**********\n";
+const char dashes[] = "----------\n";
+const char equals[] = "==========\n";
+const char nothing[] = "Sorry, I found nothing.\n";
+
+char buffer[LEN + 1];
 
 struct article {
-  
+  char sent[NUM][LEN + 1];
 } articles[N];
 
+void read_article(int id) {
+  for (int i = 0; fgets(buffer, LEN, stdin) != NULL && strcmp(buffer, asterisks); i++) {
+    printf("%s", buffer);
+  }
+}
+
 int main() {
   int n, m;
-  scanf("%d", &n);
-  while () {
-    
+  scanf("%d\n", &n);
+  for (int i = 0; i < n; i++) {
+    read_article(i);
   }
-  scanf("%d", &m);
+  scanf("%d\n", &m);
   
   return 0;
 }