Example 1
Input
exported DienTich exported dienTich exported _Ten import m/hinhhoc m/hinhhoc/internal/toan import m/app m/hinhhoc/internal/toan
Expected output
true false false true false
Example 2
Input
exported Đường import m/app m/hinhhoc import m/hinhhocmoi m/hinhhoc/internal/toan
Expected output
true true false
4 hidden tests · Limit 2 s · 256 MB
Tự cài lại hai quy tắc mà trình biên dịch Go áp dụng khi bạn dùng package của người khác:
func LaTenExported(ten string) bool
func CoTheImport(nguoiImport, duocImport string) boolLaTenExported — một định danh (tên biến, hàm, kiểu…) được export khi ký tự đầu tiên là chữ in hoa Unicode. "DienTich" → true, "dienTich" → false, "_Ten" → false, "Đường" → true, "" → false.CoTheImport — package có import path nguoiImport có được import package duocImport không, theo quy tắc thư mục internal:
duocImport không có phần tử internal nào → luôn được phép.internal cuối cùng; gọi cha là phần đường dẫn đứng trước nó. Được phép khi nguoiImport == cha hoặc nguoiImport nằm trong cây cha (bắt đầu bằng cha + "/")."m/a/internalx/b" không phải internal, và "m/hinhhocmoi" không nằm trong cây "m/hinhhoc".Ví dụ: CoTheImport("m/hinhhoc/ve", "m/hinhhoc/internal/toan") → true, CoTheImport("m/app", "m/hinhhoc/internal/toan") → false.
Mỗi dòng input là exported <tên> hoặc import <nguoiImport> <duocImport>; driver in true/false cho từng dòng (dòng exported không có tên nghĩa là chuỗi rỗng).
NOTE
Bạn chỉ viết phần code trong khung soạn thảo — package main, hàm main đọc input/in kết quả đã có sẵn. Các package đã import: bufio, fmt, os, strings, unicode, unicode/utf8. Không thêm import khác.
// LaTenExported cho biết tên có được export khỏi package không.
func LaTenExported(ten string) bool {
// TODO
return false
}
// CoTheImport cho biết package nguoiImport có được import duocImport không (quy tắc internal).
func CoTheImport(nguoiImport, duocImport string) bool {
// TODO
return false
}
Comments